When you write a powershell script on your own, or download scripts from the Internet you will not be able to execute them on your computer. This is by design and implementation of PowerShell in Windows. To overcome this, you can run PowerShell as an Administrator, or
- Start PowerShell as an Administrator
- Execute the following command:
PS C:\WINDOWS\system32> Set-ExecutionPolicy RemoteSigned
- Answer “Y” and you should get a following output
Execution Policy Change The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic at http://go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y
After executing above command, you will be able to run unsigned scripts written on you local computer. In addition you will be able to run signed scripts from the Internet.
More info about running PowerShell scripts here