Are you gearing up to deploy a new application in your organization?
I know that testing it beforehand is a crucial step to avoid any hiccups down the road. That's where running and testing installations in system context comes into play. In this guide, I'll walk you through the process step by step, using the tool, "PsExec", to ensure your deployments go off without a hitch.

Table of Contents

The Benefits of System Context Testing

Before we dive into the nitty-gritty, let's talk about why it's essential to test your applications in system context.

Running installations in system context offers several benefits:

  1. Thorough Testing: It allows you to replicate the environment in which the application will run once deployed, ensuring a more accurate test.
  2. Eliminate User Variables: User-specific configurations and permissions won't interfere with the testing process, providing a clearer picture of potential issues.
  3. Reduced Deployment Risk: By uncovering problems in advance, you can address them proactively, reducing the risk of deployment failures.

Getting Started - Tools and Prerequisites

First things first, we need the right tools and prerequisites in place. Here's what you'll need:

  • psexec: Download and install this powerful tool from the official website.
  • Administrator Access: Ensure you have administrative rights on the target machine.
  • Target Application: Have the installation files or setup executable ready for testing.

Installing and Configuring PsExec

Let's walk you through installing and configuring psexec:

  1. Download psexec: Go to the Microsoft / Sysinternals website and download the PsExec executable:
    PsExec - Sysinternals | Microsoft Learn
  2. Install PsExec: Place the PsExec executable in a directory that's part of your system's PATH variable for easy access.
  3. Test PsExec: Open a command prompt and type 'PsExec' to verify that it's installed correctly.

Running Installations in System Context

Now, the exciting part! Let's run your application installation in system context:

  1. Open Command Prompt: Launch a command prompt with administrator privileges.
  2. Navigate to psexec: Use the 'cd' command to navigate to the directory where psexec is located.
  3. Execute as System: Enter the following command to run your application installer as the system user:
    psexec -i -s cmd.exe
  4. Install Your Application: In the new command prompt window that appears, navigate to your application's installation file and run it.
  5. Complete Installation: Follow the on-screen prompts to complete the installation. Any errors or issues encountered during installation will be visible here.

Common Issues and Troubleshooting

Despite your best efforts, you might encounter some challenges while running installations in system context. Here are some common issues and their solutions:

  • Permission Errors: Ensure you have administrative rights on the target machine and that the installation file is accessible.
  • Installer Compatibility: Some installers may not work correctly when run in system context. Check the application's documentation for any specific requirements.
  • User-Specific Settings: If your application relies on user-specific settings or configurations, consider addressing these during the installation process.

Test a Win32 App

To test the installation of your Win32 application run PsExec like shown in the sample above:
psexec -i -s cmd.exe

When you have your CMD windows up and running in system context, navigate to the Path where you have stored your source files.
Heres an example:
cd "C:\Demo\7zip"

Once you're in the right directory you can simply call your installer like you define it in the "install command" section of you win32 app in Intune.
Simply like:
PowerShell -ExecutionPolicy Bypass -File Install.ps1

If you need help creating a win32 / intunewin file, I have an article here:
Create Win32 App / .intunewin | scloud

Download, Run PsExec & execute PowerShell as System with on click

Wanna automate the steps above and do everything with just one click?
I've got you covered! All with a small PowerShell Script which forces you to run PowerShell as Admin, downloads PsExec and executes it with the correct parameters to run PowerShell in the System context.

And here's the Script in Action:

Conclusion

Congratulations, you've mastered the art of running installations in system context with PsExec! By following this step-by-step guide and testing your applications thoroughly, you're well on your way to ensuring seamless deployments in your organization. Embrace this proactive approach to eliminate deployment surprises and boost your confidence in every rollout.