Search
| Login
corner corner
Relevant Links
corner corner
corner corner
Subscribe To Feed
corner corner
corner corner
Search Articles
corner corner
corner corner
Topics
corner corner
corner corner
Article List
corner corner
corner corner
Article Archive
corner corner
corner corner
Survey
Which platform does your company use?



Submit Survey  View Results
corner corner
corner corner
Relevant Links
corner corner
corner corner
Enabling Execution of PowerShell PS1 Scripts
Location: BlogsCubicZonePowerShell    
Posted by: cubiczone 7/15/2007 4:30 PM

Microsoft finally put together a powerful command line tool for Windows that makes Bash on Linux looks like small potato. The new powershell runs .NET and understands objects when you pipe from one process to another. Given the power and the things you can do with powershell, Microsoft is rightfully cautious about hackers and script abuse. PowerShell, by default, is very secure and disallows any powershell scripts from running. If you try calling a ps1 file, you'll get this error message:

File C:\Temp\Backup.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.

To run PowerShell scripts (files that end with .ps1), you must first set the execution policy to Unrestricted.

Set-ExecutionPolicy Unrestricted

Once you do that, Windows will allow you to execute any ps1 file. Enjoy!

Permalink |  Trackback

Comments (2)   Add Comment
Re: Enabling Execution of PowerShell PS1 Scripts    By Nilang on 7/21/2008 3:14 PM
Thanks a lot for your valuable post... it saved my lots of time...

Re: Enabling Execution of PowerShell PS1 Scripts    By Matthew Bearup on 7/30/2008 3:19 AM
Actually, a safer practice is to use the "remotesigned" option, as this will allow you to run all your locally generated scripts, but still offer protection against malicious internet scripts.

And if you're wondering HOW windows knows you got that script from the internet, check out Minasi's post about Alternate Data Streams :)

Cheers,
Matthew Bearup
http://www.bearupweb.net


Your name:
Title:
Comment:
Add Comment   Cancel 
corner corner