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:
Program:
- 32bit CMD: cmd.exe /c start cmd.exe
- 64bit CMD: cmd.exe /c start c:\windows\sysNative\cmd.exe
Posted on GARYTOWN.COM
Brilliant; thanks for the tip.
Nice little trick 😉 I saw you offer Greenshot as a deployment. Can you tell me how you did this because at every silent install the user receives an internet page from Greenshot.
@Michael, try this in a batch script for Greenshot...
start /wait "Installing Greenshot..." "%~dp0Greenshot-INSTALLER-1.1.9.13.exe" /LOADINF="%~dp0greenshot.inf" /LOG /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-
This is my Greenshot.inf file content
[Setup]
Lang=en
Dir=C:\Program Files\Greenshot
Group=Accessories\Greenshot
NoIcons=0
SetupType=custom
Components=greenshot,plugins\office,plugins\ocr,plugins\externalcommand
Tasks=startup
I'm also copying a modified Greenshot-defaults.ini file to the install folder, but I don't thing that is required.
This worked for me as of version 1.1.9.13
This is awesome. Thank you!