Running a ConfigMgr Task Sequence command line as a specified user

Thomas McGrath
Thomas McGrath
May 18, 2009

When you use the “Run this step as the following account” in ConfigMgr you need to be aware of the fact that the OSD environment does NOT follow to the new user environment. This means that scripts referencing the Microsoft.SMS.TSEnvironment or the BDD/MDT oEnvironment.Item objects will fail to run. So in order to workaround this you will have to parse any variables needed into the actual script using command line arguments. So in the picture below you can see how we workaround feeding the computername variable to a script that runs as domain admin, if the script had referenced the oEnvironment.Item(“COMPUTERNAME”) it would have failed.

Please fill out the form below to schedule a live demo of our solutions.