Using psexec to test vbs scripts in the Local System context

I’m sure this is  blogged elsewhere but I find it useful to have handy
so here goes 🙂

When creating packages in ConfigMgr you should have a test environment
(virtual is best, because you can take snapshots and revert snapshots to
quickly restore a clean state) and in this test environment you can test the
deployment and creation of your packages. However before you can actually test
your package via Run Advertised Programs (RAP) you’ll want to see how it reacts
in the Local System Context. This is especially true if you are installing your
software via a VBS script. If you don’t test this way then you’ll regret it
later, and sooner or later you’ll be using this method to debug why the script
is failing in the first place.


Step 1. On your virtual test machine, install psexec.

Go to this
and download psexec. When you run it for the first time you’ll need to
do so as Administrator to accept the license agreement.


Step 2. Open a command prompt and navigate to the folder that you have
psexec in, and type the following:

psexec -i -s cmd.exe

this starts a command prompt in Local System context and is perfect
for testing your VBS scripts (or Program) or just to understand why
Environmental variables may/may not be working.


Step 3. Open Windows Explorer and locate the Local copy of the vbs
(or program) you want to test.


It will create a line referring to the VBS (or program) that you are

Step 4. Prepend the line with cscript.exe
and press [Enter]

The VBS (or program) is executed in Local System context just the same
way as if being deployed as a package in SCCM.


This entry was posted in Uncategorized. Bookmark the permalink.

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.