PowerTip: Specify that a script requires admin privileges to run

Doctor Scripto

Dr Scripto

Summary: Learn how to require admin privileges to run a Windows PowerShell script.

Hey, Scripting Guy! Question How can I make sure that my Windows PowerShell script has administrator privileges to run?

Hey, Scripting Guy! Answer Use the #Requires directive and specify RunAsAdministrator. Here is an example:

#Requires -RunAsAdministrator

The Doctor

0 comments

Comments are closed.