Powershell

Stuff

Man equivalent:

Get-Help Select-String
get-help Select-String -examples

Grep equivalent:

Get-WindowsCapability -Online | Select-Object Name | Select-String -Pattern 'SNMP'

Output format

Format-Custom
Format-Hex
Format-List
Format-Table
Format-Wide

Custom properties

Get-Volume | Select-Object -Property DriveLetter,FileSystemLabel,@{label="Size(GB)";expression={$_.size/1GB}}

Within the ScriptBlock, you can use the $_ variable to reference the current object in the pipeline.

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/select-object?view=powershell-7.2

Tasks

Run a script without interferences:

powershell.exe -ExecutionPolicy Bypass myscript.ps1

Get Powershell version:

Get-Host | Select-Object Version

To create a blank file:

New-Item -ItemType file example.txt
ni -i file example.txt

https://theitbros.com/run-powershell-script-on-remote-computer/