Setting PowerShell Execution Policy
PowerShell by default will not run any scripts. Consequently, on a system where PowerShell scripts are to be used the execution policy will need to be set. In order to run script they execution policy will need to be remotesigned or unrestricted.
The key difference between them is that remotesigned can run scripts remotely signed by a signing authority, and scripts created by the system. Alternatively, the unrestricted will run any PowerShell script. Clearly, one is more conservative and less risky and one is more.
When you run a script with admin privileges, they can function with full privileges to perform any action on the system. Modifying system files, modifying user files, downloading a file from the web and installing a backdoor on your system. Avoid running scripts that you do not understand what commands they are executing.
Start PowerShell as admin the execute the following commands.
powershell set-executionpolicy remotesigned powershell get-executionpolicy
If the shell returns RemoteSigned you are all set to run PowerShell scripts in which you created on your system.
An easy trick to bypass the Unrestricted on a RemoteSigned system is to copy the text from a PowerShell script into a new file and name it .ps1. Then run that file which was created on your system.