On the lastest Windows versions is not required install PowerShell (PS) because is part of Windows Management Framework.
Updating WMF you can update and install last PS version.
First, check PS version:
(download latest version installer here)
From version 6, you can install PS on another platforms, like Ubuntu.
For security reasons, by default, PS only accept signed scripts to execute.
To check current policy type: Get-ExecutionPolicy
Common policy settings:
** Restricted: No scripts are allowed. This is the default setting.
** AllSigned: Run scripts signed by a trusted developer (will ask you to confirm that you want to run it)
** RemoteSigned: You can run your own scripts or scripts signed by a trusted developer.
** Unrestricted: You can run any script you want.
If you want to run unsigned scripts you have several alternatives to do that (In all cases you need to run PS as administrator):
— Start your scripts with:
— Run PS script file with:
powershell.exe -ExecutionPolicy ByPass -File "c:\script.ps1"
— Run from PS console or ISE session:
Set-ExecutionPolicy ByPass Process
— Run PS console with:
C:\> powershell -ExecutionPolicy RemoteSigned
Exists multiple policies availables. Also, the execution policy may be enforced by Group Policy (who may revert your execution setting).