SCCM 2007 SP1 and the Run Command Line Bug

In SCCM 2007 SP1 the console will experience an error when you try to edit a Run Command Line step that was created in SCCM 2007 RTM.  This can occur if you upgraded from RTM to SP1, if you import in SP1 a task sequence that was exported from RTM, or if you use the "Import Microsoft Deployment Task Sequence" when using MDT SCCM integration.  This issue is described on The Manageability Team Blog here.

This is caused by the fact that SCCM 2007 SP1 introduces an additional property, _SMSTSRunCommandLineAsUser, for Run Command Line tasks to support the SCCM 2007 R2 feature to run command line actions as another user.  Unfortunately, the SP1 console is not smart enough to detect that a Run Command Line step is missing this property and fix it.  It will simple try to modify the step when it is edited and generate an error when it cannot save the missing property.

The Manageability Team Blog describes two workaround.  The first, recreate all your Run Command Line tasks and delete the old ones, didn't sound too appealing since you invariably with make a mistake or two doing that.  The second, to export each task sequence, add the property node to the XML, and then import back into SCCM, is a less error prone option.  But after importing back into SCCM you have to take care to fix up all tasks that use passwords, product keys, etc. since SCCM does not include these in an export.

Manually updating the XML for all the Run Command Line tasks in all the task sequences at my current customer sounded like no picnic either.  We have 49 Run Command Line tasks in our refresh to XP Task Sequence alone.  So I figured I would create a script that would do this for me.

The script, FixRtmTaskSequences.vbs, will take an exported SCCM Task Sequence XML file, add the _SMSTSRunCommandLineAsUser to Run Command Line tasks that don't have it, and output the resulting XML to an output file.  I have provided the script below.  See the header block for usage. 

I have also included two command shell script that use FixRtmTaskSequences.vbsFixTaskSequencesInFolder.cmd will modify all the task sequence XML files in a folder tree.  The syntax for this is:  FixTaskSequencesInFolder.cmd "folderpath" "logfile" .

FixMdtSccmTemplates.cmd will backup and then modify all the task sequence XML template files that come with MDT 2008 Update 1.  These are found in the SCCM subfolder of MDT installation folder.  No parameters are required.

As with all the scripts provided on this blog, these are provided "as is" and you assume any risk from their use.

Please send me any feedback that you have.

Disclaimer: The information on this site is provided "AS IS" with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of included script samples are subject to the terms specified in the Terms of Use.

This post was contributed by Michael Murgolo, a Senior Consultant with Microsoft Services - U.S. East Region.

Comments (0)

Skip to main content