Powershell – Quick Tip #1: Run a .ps1 file

This is an egoistic post, but I need to remember this piece of information, so I’ll put it in a place I’m sure I’ll find it again. I might do that a little more often if my Google searches take too long (or my memory fails more often).

The problem: How do I run a .ps1 file (Powershell script) from within Powershell?

Attempt 1:

PS C:foo> .Install.ps1
File C:fooInstall.ps1 cannot be loaded. The file C:fooInstall.ps1 is
not digitally signed. The script will not execute on the system. Please
see "get-help about_signing" for more details..
At line:1 char:13
+ .Install.ps1 <<<<

Ok, strange but secure. How do you switch it off?

Read here for the details or continue for the summary:

The command “Get-ExecutionPolicy” will return the policy you are currently running with.

There are three options for the execution policy that you can set:

  • AllSigned (default): all scripts need to be signed.
  • RemoteSigned: Only scripts downloaded from the internet must be signed.
  • Unrestricted: Any scripts will run without being signed.

I changed the policy using “Set-ExecutionPolicy RemoteSigned” and voila…

0 Responses to “Powershell – Quick Tip #1: Run a .ps1 file”



  1. No Comments Yet

Leave a Reply




Subscribe / Search

my 'read' shelf:
 my read shelf
Imagine Cup 2009 - Egypt

msplogo_small.jpg

mcprgb.png

XING

 

November 2007
M T W T F S S
« Oct   Dec »
 1234
567891011
12131415161718
19202122232425
2627282930  

Blog Stats

  • 67,470 hits