RunAsSystem

2026.10.13.0

Select (or drag and drop) an installer, set the arguments, and run it as SYSTEM - the same way ConfigMgr and Intune do.

Two run modes are available:
 - Session 0 (default): A one-time Scheduled Task runs the installer as SYSTEM in session 0 with no desktop,
   exactly like the ConfigMgr client and the Intune Management Extension. No PsExec required.
 - Interactive
Select (or drag and drop) an installer, set the arguments, and run it as SYSTEM - the same way ConfigMgr and Intune do.

Two run modes are available:
 - Session 0 (default): A one-time Scheduled Task runs the installer as SYSTEM in session 0 with no desktop,
   exactly like the ConfigMgr client and the Intune Management Extension. No PsExec required.
 - Interactive (PsExec): Runs the installer as SYSTEM on your desktop, so any installer UI is visible.
   PsExec is downloaded from live.sysinternals.com into the installer's folder if it isn't already available.

The exit code is reported when the installer finishes, and every run is saved to a history list so it can be re-run.

Show more

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Script -Name RunAsSystem

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

(c) 2026 Michael Escamilla

Package Details

Author(s)

  • Michael Escamilla

Functions

Test-IsAdmin Invoke-RelaunchElevated Get-InstallerType Get-ModeText Get-DefaultLogPath Update-DefaultLogPath Get-ComboBoxTag Set-ComboBoxTag Set-StatusBar Get-FormState Set-FormState Reset-Form Clear-RunResult Reset-FormOptions Get-ArgumentTokenValues Expand-ArgumentTokens Get-CommandSpec Get-PsExecPath Save-PsExec Get-PsExecArguments Add-ArgumentToken Update-TokenToolTips Update-CommandPreview Update-FileSelection ConvertTo-Int32 Get-ExitCodeInfo Connect-TaskService Register-SystemTask Test-OwnSystemTask Get-SystemTaskStatus Remove-SystemTask Clear-StaleSystemTasks Test-CaptureOutput Get-OutputCaptureCommand New-OutputFile Test-OutputFile Get-OutputLastLine Update-StdoutLine Set-RunningState Set-ResultDisplay Copy-ExitCode Start-SystemRun Watch-SystemRun Get-RunProcessId Stop-SystemRun Complete-SystemRun Protect-HistoryValue Unprotect-HistoryValue Get-History Save-History Add-HistoryEntry Update-HistoryList Import-HistoryEntry Copy-HistoryEntry Update-HistoryButtons Enable-ElevatedDragDrop Start-BackgroundUpdateCheck Show-UpdateAvailable Get-UpdateChannel Open-ReleasePage Update-ScriptFile Restart-Script Install-RightClickMenu Uninstall-RightClickMenu

Dependencies

This script has no dependencies.

Release Notes

2026.10.13.0  - Variables for ArgumentList, filled in when the installer runs: {LogFile}, {InstallerDir} and {InstallerName}
Click a variable on the new Insert line under ArgumentList to add it at the cursor; its tooltip shows the value for the loaded file
{LogFile} is a log next to the installer (Setup.exe.log), for EXE installers that take a log path with their own switch, like /log "{LogFile}"
Open Log now works for any installer with {LogFile} in its arguments, not only MSI and MSP
{InstallerName} keeps the extension, so a product's EXE and MSI logs stay apart, e.g. /log "{InstallerDir}\{InstallerName}.Uninstall.log"
History keeps the variables, so loading a run fills them in for that file; the Command Line box shows the real paths
Copy arguments copies just the arguments with the variables filled in
2026.10.12.0  - Session 0 runs of EXE, PS1, CMD, BAT and VBS files now capture what the installer writes to stdout and stderr, which was lost before
The latest line of output is shown in the result as a Stdout line, updated while the installer runs; click it to open the full output
The installer's exit code and arguments are unchanged, and the last 50 outputs are kept in %LOCALAPPDATA%\RunAsSystem\Output
Open Folder moved into the File box as a folder icon, available whenever the file exists, before or after a run
Open Log only appears when there's a log to open: an MSI or MSP run with logging on, once the log file has been written
Evened out the spacing above and below the Run button
2026.10.10.0  -Clicking Update Available now installs the update and reopens the tool with the same file loaded, like GetMSIInformation
A downloaded or right-click menu copy of the script is replaced with the new version, and a PowerShell Gallery install is updated with Update-Script
If the update can't be installed (offline, the file is locked or the download is damaged), the release page opens instead
Launched with iex (irm ...), it still opens the release page, since the next launch is already the latest
Updating is blocked while an installer is running, so the run's exit code isn't lost
Relaunching as administrator, or after an update, now uses the PowerShell the tool was started in, so starting from pwsh no longer drops to Windows PowerShell 5.1
The window opens faster: the update check now runs after the window has appeared
Open Log can be used while an install is running, as soon as the log file is created, so you can follow the install
Fixed Open Log and Open Folder opening the previous run's files while a new run was in progress
Loading a different file now clears the previous run's result, Open Log and Open Folder
The right-click menu now opens the tool in PowerShell 7.4+ when it's installed, like GetMSIInformation, and in Windows PowerShell 5.1 otherwise (reinstall the menu to switch)
Click the exit code, or its hex value, in the result to copy it for looking up
Status bar messages now clear after a few seconds, like CodeSigningTool, except ones that ask you to do something
2026.10.9.1   - Credit Ben Whitmore and his Patch My PC Connectivity tool, which inspired RunAsSystem, in the README and the script help
2026.10.9.0   - Arguments and command lines saved in history are now encrypted with DPAPI, so only your Windows account on that device can read them
History entries show their arguments, with Load and Copy buttons when you hover over an entry
New Current user run mode: runs the installer as the account running the tool, through a scheduled task
New Stop button that ends the running process and anything it started (an MSI install keeps running in Windows Installer)
New Reset button (or Ctrl+R) that puts the window back to how it opens
Keyboard shortcuts: Ctrl+Enter or F5 to run, Ctrl+O to browse, Ctrl+L to load from history, Ctrl+R to reset
The hex exit code is always shown under the decimal code
MSI logs are named after the action, for example Setup.msi.Install.log and Setup.msi.Uninstall.log
Choosing a file of a different type resets the options
The arguments box is now called ArgumentList, wraps long text and grows to about three lines
Sections are grouped into cards, with a new window background colour
Removed the /norestart checkbox (type /norestart in ArgumentList when needed)
2026.10.6.0   - Initial release

FileList

Version History

Version Downloads Last updated
2026.10.13.0 (current version) 1 10/13/2026
2026.10.12.0 1 10/13/2026
2026.10.10.0 4 10/10/2026
2026.10.9.1 6 10/10/2026
2026.10.9.0 4 10/10/2026