You don't get far with PowerShell before you need to understand Execution Policies, in fact you probably won't be able to run a script until you do!
So, the execution policy controls what is allowed to run and its scope controls where this applies. So the Execution Policy is one of the following:
You can check the current Execution Policy with a simple get command
Get-ExecutionPolicy -Scope CurrentUser of course you need to be running PowerShell to do this. If CurentUser returns "Undefined" then the Local Machine policy is active. You can also get a complete list via
Get-ExecutionPolicy -List which is much easier and more helpful.
If they don't run and you just want to make them run then the following command is handy and remains in place until you close the process as it only applies to that instance of the PowerShell process.
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
When running scripts outside of PowerShell itself I use one of two approaches. I sometimes write a Windows Command Script or batch file as follows:
PowerShell.exe -ExecutionPolicy Bypass -File "C:\Files\Test.ps1"
Then you can just double click the .cmd file. More recently however I have taken to using Windows Shortcuts, to PowerShell.exe and then putting the command line arguments from the script above into the shortcut. Generally I prefer the latter approach, however at other times the Command Script is more flexible.
Make sure you check what your Execution Policy is before you change it, unless you use
-Scope Process which is more temporary.
You can get more information on this as well as details on how to sign your scripts at Windows PowerShell User's Guide. I strongly recommend that you do not Unrestricted or Bypass the policy for your local machine or user, especially if the user has Administration rights. The Bypass execution policy was introduced with PowerShell 2.0 but hopefully now you will not see anything that old.
There is also information on running scripts at Windows Powershell: How to run windows powershell scripts and Signing PowerShell Scripts - Scott Hanselman covers how to sign scripts