Test application installers in System context using a Schedule Task

When deploying an Application using SCCM or Intune for that matter, the installation is run in System Context if you don’t select to run it as the user. I have answered this question I think once a day this week on Technet forum where the application fails when deployed using SCCM but works when tested manually.
To test an application that are to be deployed using SCCM/Intune it must be tested by installing it in System context not as a logged-on administrator, then you will spot all errors with custom actions in and MSI that checks for currently logged on user or issues like that.

To test an application Psexec, from SysInternals, is a great tool, there is however a simpler way, using the Task Scheduler which is already there. Psexec is not allowed by some Anti-Malware for instance but the Task Scheduler is.

I start by copying my installation files to C:\Temp on my test machine. Then launch Task Scheduler and select “Create a Task”

  1. Give it a name and set that it should run in System Context as shown below.
  2. Then we skip to the Actions tab and select “New”
  3. We use the “Start a program” task
    And as an argument we use the following commands to run the .MSI silent and with verbose logging. /i “C:\temp\7z1701-x64.msi” /QN /L*V “C:\temp\7z1701-x64.log”
  4. Select OK

Then we ready to start our task to install 7-zip under the System Context by simply select “Run” in the Task we created.

When the task is finished 7-zip is installed, if we look in the verbose .MSI log file which was created during the installation, we can see that it was run under the System Context.

Really simple!

If we use Psexec we can use the following command after downloading and unpack psexec from here: https://docs.microsoft.com/en-us/sysinternals/downloads/psexec

Example command line for using psexec to test a Windows installer package in System Context:

The result is the same as using a Schedule Task.

Testing your applications in the correct context before deploying them will save you a lot of time and headache.

Happy testing!

 

 

 

 

One Comment

Add a Comment

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