You’ve downloaded a PowerShell script from a reliable website and you want to use it to perform some task in your test environment. The script isn’t signed, so you use the Set-ExecutionPolicy cmdlet to set your PowerShell execution policy to Unrestricted. But when you try to run the script, you get an error saying the script can’t run.
Try this: right-click on the .ps1 file for the script in Windows Explorer, select Properties, and click Unblock if there is an Unblock button on the General tab of the Properties page for the file. We often forget that the default behavior since Windows XP SP2 is to restrict what you can do with files downloaded to your computer. See this KB article for more info:
What if you downloaded a bunch of files into a folder and want to unblock all of them? You can use the Windows Sysinternals utility called Streams to do this as described in this thread from the TechNet Forums:
It gets even better on Windows 8 with the new Unblock-File cmdlet of PowerShell 3.0:
The above tip was previously published in an issue of WServerNews, a weekly newsletter from TechGenix that focuses on the administration, management and security of the Windows Server platform in particular and cloud solutions in general. Subscribe to WServerNews today by going to http://www.wservernews.com/subscribe.htm and join almost 100,000 other IT professionals around the world who read our newsletter!
Mitch Tulloch is an eleven-time recipient of the Microsoft Most Valuable Professional (MVP) award and a widely recognized expert on Windows Server and cloud computing technologies. Mitch is also Senior Editor of WServerNews. For more information about him see http://www.mtit.com.