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.

MemberServer task sequence editor

Thomas McGrath
Thomas McGrath is a journalist, presenter and digital content specialist. He has written for the likes of Telecoms.com, Digital TV Europe and Business Cloud News, among others, covering topics such as apps, the Internet of Things and TV. He lives in London with his wife, son and cat.