20 March 2013

Powershell: Adding powershell Run-as Administrator Option

Share

For some Powershell scripts, they need the elevated privileges, even when UAC is disabled. In order to do this, there are two options.

Run a cmd.exe session as administrator and execute the PS1 file from the command line.

Add the registry key listed below to be able to right-click on a PS1 file and run-as administrator.

All you need to do is copy the info below to a blank notepad screen and then save it as {Filename}.reg. Double-click on the reg file and the key will be added to the registry, thereby adding the run-as administrator option. Here is the reg key to add the run-as administrator option: