ConfigMgr 2007: Attempting to edit or modify Run Command Line tasks in OSD Task Sequences causes an error
Here's yet another tip from Frank Rojas, this one concerning errors you might receive when trying to edit Run Command Line tasks:
========
Issue: When attempting to edit or modify Run Command Line tasks in SCCM 2007 SP1 OSD Task Sequences, the following error may occur:
An error occurred in ConfigMgr. The ConfigMgr console will continue to function, however you should save your work and restart the console. After restarting the console, verify that your last configurations have been applied.
It will have the following details:
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlQueryPropertySingleItem.get_BooleanValue()
at Microsoft.ConfigurationManagement.AdminConsole.TaskSequenceEditor.RunCommandLineControl.SetDirtyFlag()
at Microsoft.ConfigurationManagement.AdminConsole.TaskSequenceEditor.RunCommandLineControl.checkBox64Bit_CheckedChanged(Object sender, EventArgs e)
at System.Windows.Forms.CheckBox.OnCheckedChanged(EventArgs e)
at System.Windows.Forms.CheckBox.set_CheckState(CheckState value)
at System.Windows.Forms.CheckBox.OnClick(EventArgs e)
at System.Windows.Forms.CheckBox.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Additionally, the Application Event Log will show the following Error message:
Event Type: Error
Event Source: Configuration Manager Console
Event Category: None
Event ID: 0
Description: An error occurred in ConfigMgr. The ConfigMgr console will continue to function, however you should save your work and restart the console. After restarting the console, verify that your last configurations have been applied.
An error occurred in ConfigMgr. The ConfigMgr console will continue to function, however you should save your work and restart the console. After restarting the console, verify that your last configurations have been applied.
at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlQueryPropertySingleItem.get_BooleanValue()
at Microsoft.ConfigurationManagement.AdminConsole.TaskSequenceEditor.RunCommandLineControl.SetDirtyFlag()
at Microsoft.ConfigurationManagement.AdminConsole.TaskSequenceEditor.RunCommandLineControl.checkBox64Bit_CheckedChanged(Object sender, EventArgs e)
at System.Windows.Forms.CheckBox.OnCheckedChanged(EventArgs e)
at System.Windows.Forms.CheckBox.set_CheckState(CheckState value)
at System.Windows.Forms.CheckBox.OnClick(EventArgs e)
at System.Windows.Forms.CheckBox.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
For more information, see Help and Support Center at https://go.microsoft.com/fwlink/events.asp.
Finally, the SmsAdminUI.log will show the following error message:
An error occurred in ConfigMgr. The ConfigMgr console will continue to function, however you should save your work and restart the console. After restarting the console, verify that your last configurations have been applied.
An error occurred in ConfigMgr. The ConfigMgr console will continue to function, however you should save your work and restart the console. After restarting the console, verify that your last configurations have been applied.
at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlQueryPropertySingleItem.get_BooleanValue()
at Microsoft.ConfigurationManagement.AdminConsole.TaskSequenceEditor.RunCommandLineControl.SetDirtyFlag()
at Microsoft.ConfigurationManagement.AdminConsole.TaskSequenceEditor.RunCommandLineControl.checkBox64Bit_CheckedChanged(Object sender, EventArgs e)
at System.Windows.Forms.CheckBox.OnCheckedChanged(EventArgs e)
at System.Windows.Forms.CheckBox.set_CheckState(CheckState value)
at System.Windows.Forms.CheckBox.OnClick(EventArgs e)
at System.Windows.Forms.CheckBox.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Cause: This issue can occur under one of the three following circumstances:
- A Task Sequence with a Run Command Line task is created in SCCM 2007 RTM, and then SCCM 2007 is upgraded to Service Pack1 (SP1).
- A Task Sequence with a Run Command Line task is created in SCCM 2007 RTM, and then the Task Sequence is exported from SCCM 2007 RTM, and then imported into SCCM 2007 SP1.
- A Task Sequence is created in SCCM 2007 SP1 via the "Import Microsoft Deployment Task Sequence" option when Microsoft Deployment Toolkit 2008 (MDT 2008) is integraged with SCCM 2007 SP1.
The issue happens because in SCCM 2007 SP1, the following line is added as part of the XML source code for Run Command Line tasks:
<variable name="_SMSTSRunCommandLineAsUser" property="RunAsUser">false</variable>
SCCM 2007 RTM and MDT 2008 do not add this line. If this line is missing, the error occurs.
Resolution: There are two workarounds for this issue:
1. In SCCM 2007 SP1, create a new Run Command Line task immediately after the affected Run Command Line task and then manually copy all of the settings from the affected Run Command Line task to the newly created Run Command Line task. Once everything has been copied over to the newly created Run Command Line task, the old original Run Command Line task can be deleted.
2. Export the task sequence with affected Run Command Line tasks, then open the exported XML file in an XML editor (such as Notepad), and then add the line:
<variable name="_SMSTSRunCommandLineAsUser" property="RunAsUser">false</variable>
in between the following two lines:
<variable name="SMSTSDisableWow64Redirection" property="DisableWow64Redirection">false</variable>
<variable name="SuccessCodes" property="SuccessCodes" hidden="true">0 3010</variable>
so that it appears as follows on each of the affected Run Command Line tasks:
<variable name="SMSTSDisableWow64Redirection" property="DisableWow64Redirection">false</variable>
<variable name="_SMSTSRunCommandLineAsUser" property="RunAsUser">false</variable>
<variable name="SuccessCodes" property="SuccessCodes" hidden="true">0 3010</variable>
Once all of the affected Run Command Line tasks have been updated with the appropriate line, save the XML file and then import the task sequence back into SCCM 2007 SP1 to create a new task sequence. Once the newly created task sequence is confirmed to be working, the old task sequence with the affected Run Command Line tasks can be deleted. This method is a bit riskier since improperly editing the XML file can causes issues, but it may be quicker for task sequences that contain many Run Command Line tasks.
========
Thanks Frank!
J.C. Hornbeck | Manageability Knowledge Engineer
Comments
- Anonymous
January 01, 2003
The comment has been removed - Anonymous
January 01, 2003
The comment has been removed - Anonymous
January 01, 2003
thank you