lang/ps/ PsBasics


Get-Command
Get-Help Get-Command
Get-Help Get-Command -Online
Get-Command New-SmbShare | Select-Object Name
Get-Command New-SmbShare | Format-List
Get-Command *Smb*

New-Guid
New-Guid | Write-Host
New-Guid | ForEach { $_.Guid } | clip

Enabling scripts

Get-ExecutionPolicy
Set-ExecutionPolicy RemoteSigned # allows local scripts

Strings, Patterns, Wildcards

Get-ChildItem -Path "C:\Windows\*" -Filter *.exe
Get-ChildItem -Path "C:\Windows\*" | Where-Object { $_.Name -Match "^se" } # find files whose names start with "se"

the latter is the equivalent of the bash

ls /c/Windows/* | grep ^se