It’s not possible to run a Powershell script directly by double-clicking the ps1 script file. The scripts can be executed in one of two ways.

1) From the Powershell command line, type the path to the script:


2) Call the script from a BAT file:

powershell c:\scripts\PowershellScript.ps1

or if the BAT file is in the same directory as the script:

powershell .\PowershellScript.ps1

Execution of script is turned off by default. It can be enabled by running this command in Powershell:

set-executionpolicy remotesigned

 The RemoteSigned option requires that all scripts downloaded from the Internet must be signed by a trusted publisher. Alternately, the Unrestricted option can be used to run all scripts. If you’re blocked from setting this for all users, append ‘-Scope CurrentUser’ to set for just the current user.