T (WJ) - GitHub Pages
Assignment, Logical, Comparison Operators
Update-Help
Downloads and installs newest
help files
+=, ?=, ¡Á=, ¡Â=, %=, +
+, ??, =
Assigns one or more values to a
variable
Get-Help
Displays information about
commands and concepts
-and,-or,-not,-xor,!
Connect expressions / statements
-eq, -ne
Equal, not equal
-gt, -ge
Greater than, greater than or equal
-lt, -le
Less than, less than or equal
-replace
¡°Hi¡± -replace ¡°H¡±, ¡°P¡±
-match,-notmatch
Regular expression match
-like,-notlike
Wildcard matching
Get-Command
Gets all commands
Get-Member
Gets the properties and methods
of objects
Get-Module
Get-Service
Get-Process
Gets the modules that have been
imported or that can be imported
into the current session
Gets the services on a local or
remote computer
Gets the processes that are
running on the local computer or a
remote computer
Flow Control
If(){ } Elseif(){ } Else{ }
-contains,-notcontains Check if value in array
-in, -notin
Reverse of contains,notcontains
Case-Sensitive Comparison
-ceq, -cne, -clike, -cnotlike, -cnotmatch, -ccontains, cnotcontains
Aliases for Common commands
Gcm
Get-Command
Fl
Format-List
$arr = "a", "b"
Array of strings
Foreach,%
Foreach-Object
Gcim
Get-CimInstance
$arr = @()
Empty array
Sort
Sort-Object
Cat,gc,type
Get-Content
$arr[5]
Sixth array element
Where,?
Where-Object
Sc
Set-Content
$arr[-3..-1]
Last three array elements
Diff,compare Compare-Object
h,history,ghy
Get-History
$arr[1,4+6..9]
Elements at index 1,4, 6-9
Dir, ls, gci
Get-ChildItem
r,Ihy
Invoke-History
$arr[1] += 200
Add to array item value
Gi
Get-Item
Gp
Get-ItemProperty
$z = $arA + $arB
Two arrays into single array
Copy,cp,cpi
Copy-Item
Sp
Set-ItemProperty
[pscustomobject]@{x=1;z=2}
Create custom object
Move,mv,mi
Move-Item
Pwd,gl
Get-Location
(Get-Date).Date
Date property of object
Del,rm
Remove-Item
Gm
Get-Member
Rni,ren
Rename-Item
Sls
Select-String
#,
Comment, Multiline Comment
Ft
Format-Table
Cd,chdir,sl
Set-Location
"`"test`""
Escape char `
Gcm
Get-Command
Cls,clear
Clear-Host
`t
Tab
`n
New line
Case-Insensitive Comparison
while() { }
For($i=0; $i -lt 10; $i++) { }
-ieq, -ine, -ilike, -inotlike, -inotmatch, -icontains, inotcontains
Foreach($file in dir C:\) {$file.name}
Setting Security Policy
1..10 | foreach{$_}
Importing, Exporting, Converting
Arrays, Objects
Part of Cmdlets
Comments, Escape Characters
Get-EventLog
Get-WinEvent
Get-Date
`
Line continue
New-Item
Set-Item
Move-Item
&
The call operator, "invocation operator"
Copy-Item
Remove-Item
Compare-Object
Common Automatic Variables
Get-Content
Set-Content
Add-Content
$$
Last token of the previous command line
View and change execution policy with Get-Execution and
Set-Execution policy:
Start-Sleep
Start-Job
Get-CimInstance
$?
Boolean status of last command
Get-Credential
Test-Connection
New-PSSession
$^
First token of the previous command line
Test-Path
Split-Path
Get-History
$_, $PSItem
Current pipeline object
Get-ADUser
Get-ADComputer
New-ISESnippet
$profile
The standard profile (may not be present)
Get-WMIObject
Out-File
Out-String
$PsVersionTable
Details about the version of PowerShell
Export-CliXML
Import-CliXML
Get-Executionpolicy
ConvertTo-XML
ConvertTo-HTML
Set-Executionpolicy
Export-CSV
Import-CSV
ConvertTo-CSV
ConvertFrom-CSV
- Restricted
- AllSigned
- RemoteSigned
- Unrestricted
1
Windows PowerShell CheatSheet (WJ)
Useful Commands
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- automation using powershell
- powershell quick reference t
- azure sentinel management using powershell
- powershell basic cheat sheet rambling cookie monster
- powershell for beginners
- aws tools for powershell
- t wj github pages
- pester cheat sheet
- powershell cheat sheet import export convert
- active directory recycle bin lepide