Run PowerShell ISE as System to Test scripts… From Software Center

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"

image

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.

image

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.

image

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.

Posted on GARYTOWN.COM

3 thoughts on “Run PowerShell ISE as System to Test scripts… From Software Center

  • September 4, 2018 at 7:53 pm
    Permalink

    Brilliant; thanks for the tip.

    Reply
  • September 5, 2018 at 3:29 am
    Permalink

    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.

    Reply
  • September 17, 2018 at 8:44 am
    Permalink

    @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

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.