Live Webinar: The Pareto Principle & How the 80/20 Rule Applies to Windows Servicing - August 27, 2019 Register Now

Running a ConfigMgr Task Sequence command line as a specified user

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.

Share this post

Share this post on your favorite social media platform.

Find this article useful?

If so please click here