When you first get started with PowerShell, don’t forget to run ‘Set-ExecutionPolicy RemoteSigned’ from the PowerShell prompt. If you try to run a script without doing that first, expect to see a message like the following:
File <path to file> cannot be loaded because execution of scripts is disabled on this system. Please see “get-help about_signing” for more details.
The default execution policy for PowerShell is “Restricted” (commands only, not scripts). The other execution policy options (in decreasing order of strictness) are:
- AllSigned
- RemoteSigned
- Unrestricted
When I first tripped over this, the resource that helped most was a TechNet article. Later, I found a blog post that was more specific about the execution policies.