SetExeToRunAsAdmin is a script that lets you manage administrator privileges for EXE files. You can specify the path of the EXE file using the -Path parameter. You
can also set multiple EXE files to use wildcards to specify multiple files. Additionally, you can choose to modify the administrator setting for the current user or all users on the system using the -CurrentUser and -AllUsers parameters. To undo the administrator setting, use the -UnsetInstead parameter.
On any Windows machine, open PowerShell as Administrator and type...
Install-Script SetExeToRunAsAdminand accept the prompts.
This script is published on PowerShell Gallery.
The code is signed, so if you want to change it, just removed the # SIG # Begin signature block line and everything beneath it.
SetExeToRunAsAdmin -Path <exe path/pattern> (-CurrentUser | -AllUsers | -UnsetInstead | -RegJump)| Parameter | Description | Required |
|---|---|---|
-Path |
The path of the EXE or pattern to match | Yes, unless using the RegJump switch |
-CurrentUser |
Set for the current user (default) | No |
-AllUsers |
Set for all users | No |
-UnsetInstead |
Unset | No |
-RegJump |
Use RegJump to jump to the app registry key | No |
SetExeToRunAsAdmin -Path "C:\Shared\example.exe"SetExeToRunAsAdmin -Path "C:\Shared\example.exe" -UnsetInsteadSetExeToRunAsAdmin -Path "C:\Shared\*.exe"SetExeToRunAsAdmin -Path "C:\Shared\*.exe" -UnsetInsteadSetExeToRunAsAdmin -RegJumpSetExeToRunAsAdmin -CurrentUser -RegJumpSetExeToRunAsAdmin -AllUsers -RegJump