Getting Started

Start as Administrator

Start PowerShell from Windows Start, and note run it as Administrator. Start Powershell

PowerShell in Windows10 looks something like this: Powershell

Hello World in PowerShell

Write the following command to console and press Enter:

Write-Host "Hello World!"

Hello World

Moving in Tree

You can move from and to a folder with DOS-command cd. Please, note that command cd ~ moves you to your home folder. Nice ;-) Move in Tree

Verb-Noun -format

Commands are in form Verb-Noun. Example: If you want to know basic information of your computer write to following:

Get-ComputerInfo

ComputerInfo

You can specify what information you want to get by setting a property name:

Get-ComputerInfo -Property "OsName"

Computer's OS

Clear-Host

Clear-Host or shortly alias cls clear console. Nice :-) Clear-Host

What PowerShell Version?

There are many versions of PowerShell. The newest is PowerShell 7.3 (in January 2023).

There are many ways to find out what version you have on your computer. One way is to use $host-variable.

$HOST.version

PowerShell
Version

PowerShell7
Version7

The second way is to use $PSVersionTable-variable.

$PSVersionTable

Version

Please note: PowerShell Core is essentially a new platform that is installed on the computer along with Windows PowerShell. It means that you cannot upgrade PowerShell 5.1 to PowerShell Core 7.1. PowerShell 7 is installed on a computer separately from Windows PowerShell 5.1. In PowerShell 7.1, the developers added maximum compatibility with Windows PowerShell. Please, read more

You can install the version 7 to your computer if you have a older version. Install version Here is PowerShell 7 console. Version 7

Script files

You can write PowerShell script files with any text editor or tool. Save the script file with .ps1 extension! A script file

We recommend PowerShell ISE or Visual Studio Code for writing scripts

You can select any text editor you want to, but we recommend:
1) PowerShell ISE PowerShell ISE 2) Visual Studio Code with PowerShell Extension
Visual Studio Code

PowerShell execution policies

There can be restrictions to execute PowerShell on your Windows Platform. The Default execution policy is on Windows clients restricted. On non-Windows computers, the default execution policy is Unrestricted and cannot be changed. Restricted Execution You can get the current execution policy with cmdlet Get-ExecutionPolicy. You can set the execution policy with cmdlet Set-ExecutionPolicy. Note, that you have run it as Admiministrator. Set Execution Policy Read more about Execution Policy