Yet another post caused by my recent rebuilding of my lab from scratch after I totally hosed my last CM Server. This time I’m documenting (blogging) a few additional things.
So you write a lot of scripts for ConfigMgr? Notice that they sometimes don’t perform quite as expected because they run as system instead of a user? Quick and easy way to make the PowerShell ISE available for you to test running your scripts as System. Nope, it’s not PSExec… this is even easier.
Super Simple, almost feel it’s not even blog worthy, but here it is anyway.
- Make a Package, no Content (PowerShell ISE x64)
- Make a program (RunAsSystem)
- Command: %SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe –command "ise"
- Program Environment - Only when a user is logged on – Check Box “Allow Users to interact with this program”
Then Deploy it to a user or user group, very limited test group, as this gives anyone with this deployment full system access to their machine.
When you click Install, you’ll see the black command window for a second, then the ISE start launching. Once Launched, you’ll see it is running as System.
Now you can test your script under the same context that CM would run this. I use this all the time to test things I plan to load into the scripts node.
If you just want to launch a command prompt:
- 32bit CMD: cmd.exe /c start cmd.exe
- 64bit CMD: cmd.exe /c start c:\windows\sysNative\cmd.exe
Posted on GARYTOWN.COM