PowerShell has something called Execution Policies, which stop you from just running any old script. In fact, by default, you can’t run any scripts and need to change your execution policy if you want to be allowed to run them. There are 4 notable Execution Policies:
- Restricted: This is the default configuration in PowerShell. This setting means that no script can run, regardless of its signature. The only thing that can be run in PowerShell with this setting is an individual command.
- AllSigned: This setting does allow scripts to run in PowerShell. The script must have an associated digital signature from a trusted publisher. There will be a prompt before you run the scripts from trusted publishers.
- RemoteSigned: This setting allows scripts to be run, but requires that the script and configuration files that are downloaded from the Internet have an associated digital signature from a trusted publisher. Scripts run from the local computer don’t need to be signed. There are no prompts before running the script.
- Unrestricted: This allows unsigned scripts to run, including all scripts and configuration files downloaded from the Internet. This will include files from Outlook and Messenger. The risk here is running scripts without any signature or security. It is recommenced that you never us this setting.
To see what your current Execution Policy is set to, open a PowerShell Console and type:
To run this command you need to run the PowerShell with Administrative rights. Right click on icon and select Run as Administrator and try the command again.
When i run PowerShell as Administrator, now i am able to execute the command successfully as in below screen.
The proper term for a PowerShell command is a cmdlet, and from now on we will use this correct terminology. It just felt more appropriate to call them commands for this introduction.
I will come up with more stuffs in my upcoming posts.
Till then keep practicing and stay tuned for more details.