BACK
TOP
The full guide of PowerShell that any developer needs to know – Installation and Setup
Matías Creimerman - Buenos Aires, Argentina - 2019-10-07

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:

01

(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:
Set-ExecutionPolicy RemoteSigned

 

— 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).

 

Extra documentation:

This content is property of Matias Creimerman
Any misuse of this material will be punishable
This work is licensed under a
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License
Creative Commons License