Executing Powershell Scripts

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: