Back to All Cheatsheet Libraries cheatsheets

PowerShell

A searchable reference of 100 essential cmdlets for Windows sysadmins, core pipeline/object concepts, and habits for working faster and safer.

Total Cmdlets: 0
Category Cmdlet Description
System InfoGet-CommandLists all available PowerShell commands.
System InfoGet-HelpAccesses the help documentation for a cmdlet.
System InfoGet-HotfixRetrieves information about installed hotfixes/patches.
System InfoGet-ServiceLists all installed services and their status.
System InfoGet-ProcessDisplays running processes on the system.
System InfoGet-EventLogAccesses classic event log data.
System InfoGet-WmiObjectQueries WMI (Windows Management Instrumentation) objects.
System InfoGet-WinEventRetrieves event log data with advanced filtering options.
System InfoGet-CounterAccesses performance counter data.
System InfoGet-WindowsFeatureDisplays installed Windows Server roles/features.
Active DirectoryGet-ADUserRetrieves Active Directory user information.
Active DirectoryGet-ADGroupLists Active Directory groups.
Active DirectoryGet-ADComputerFetches Active Directory computer object information.
Active DirectorySet-ADUserModifies Active Directory user properties.
Active DirectorySet-ADGroupModifies Active Directory group properties.
Active DirectorySet-ADComputerModifies Active Directory computer object properties.
Active DirectoryGet-ADDomainRetrieves Active Directory domain information.
Active DirectoryGet-ADOrganizationalUnitLists Active Directory organizational units (OUs).
Active DirectoryGet-ADDomainControllerFetches Active Directory domain controller information.
Active DirectoryGet-ADSiteDisplays Active Directory site information.
Active DirectoryGet-ADFineGrainedPasswordPolicyViews fine-grained password policies in Active Directory.
NetworkingGet-NetAdapterDisplays network adapter information.
NetworkingGet-NetConnectionProfileViews network connection profiles (Public/Private/Domain).
NetworkingTest-NetConnectionChecks network connectivity to a specific host or port.
NetworkingEnable-NetAdapterEnables a network adapter.
NetworkingDisable-NetAdapterDisables a network adapter.
NetworkingGet-NetIPAddressLists IP addresses assigned to network adapters.
NetworkingGet-NetRouteDisplays IP routing table information.
NetworkingGet-NetTCPConnectionShows current TCP connections.
NetworkingGet-NetUDPEndpointLists active UDP connections.
NetworkingGet-NetNatViews Network Address Translation (NAT) settings.
NetworkingGet-NetNatTransitionConfigurationFetches NAT64/DNS64 configuration.
NetworkingNew-NetIPAddressCreates a new static IP address on an interface.
NetworkingNew-NetRouteCreates a new IP route.
NetworkingNew-NetTCPAclCreates a new TCP access control list entry.
NetworkingSet-NetTCPSettingConfigures TCP stack settings.
NetworkingGet-DnsClientDisplays DNS client settings per interface.
NetworkingSet-DnsClientServerAddressSets DNS server addresses for an interface.
NetworkingGet-NetAdapterAdvancedPropertyLists advanced driver properties of a network adapter.
NetworkingGet-NetAdapterBindingDisplays network adapter protocol bindings.
NetworkingTest-ConnectionPings a remote host (PowerShell's ping equivalent).
FirewallGet-NetFirewallProfileShows firewall profiles (Domain/Private/Public).
FirewallGet-NetFirewallRuleRetrieves firewall rules.
FirewallSet-NetFirewallRuleModifies an existing firewall rule.
FirewallNew-NetFirewallRuleCreates a new firewall rule.
FirewallGet-NetFirewallAddressFilterShows address filters attached to a firewall rule.
FirewallGet-NetFirewallPortFilterShows port filters attached to a firewall rule.
FirewallGet-NetFirewallApplicationFilterShows application filters attached to a firewall rule.
FilesystemGet-ChildItemLists files and directories (aliased as ls, dir).
FilesystemSet-ItemModifies the value/properties of an item.
FilesystemNew-ItemCreates a new file, directory, or registry key.
FilesystemRemove-ItemDeletes a file, directory, or other item.
FilesystemCopy-ItemCopies a file or directory.
FilesystemMove-ItemMoves a file or directory.
FilesystemGet-ContentDisplays the content of a file (aliased as cat, type).
FilesystemSet-ContentWrites/overwrites the content of a file.
FilesystemTest-PathChecks if a file, directory, or registry key exists.
FilesystemNew-PSDriveMaps a drive to a location in the PowerShell namespace.
Disks & StorageGet-VolumeLists information about volumes.
Disks & StorageGet-DiskRetrieves information about physical disks.
Disks & StorageInitialize-DiskInitializes a new, uninitialized disk.
Disks & StorageNew-PartitionCreates a new partition on a disk.
Disks & StorageFormat-VolumeFormats a volume with a file system.
Disks & StorageGet-DedupStatusChecks the status of data deduplication on a volume.
Disks & StorageStart-DedupJobStarts a data deduplication job.
Disks & StorageGet-DedupJobViews data deduplication job status.
Data & PipelineSelect-ObjectChooses specific properties to display from an object.
Data & PipelineSort-ObjectSorts objects based on specified properties.
Data & PipelineWhere-ObjectFilters objects based on specified criteria.
Data & PipelineMeasure-ObjectCalculates properties of objects, like count or size.
Data & PipelineGroup-ObjectGroups objects by a shared property value.
Data & PipelineOut-FileRedirects pipeline output to a file.
Data & PipelineExport-CsvExports objects to a CSV file.
Data & PipelineImport-CsvImports rows from a CSV file as objects.
Data & PipelineConvertTo-JsonConverts objects to JSON format.
Data & PipelineConvertFrom-JsonConverts JSON text into PowerShell objects.
Data & PipelineGet-DateDisplays the current date and time.
Data & PipelineGet-RandomGenerates a random number or picks a random element.
Scheduled TasksGet-ScheduledTaskLists scheduled tasks.
Scheduled TasksNew-ScheduledTaskDefines a new (unregistered) scheduled task object.
Scheduled TasksRegister-ScheduledTaskRegisters a scheduled task with Task Scheduler.
Scheduled TasksUnregister-ScheduledTaskRemoves a scheduled task.
PrintersGet-PrinterRetrieves information about installed printers.
PrintersAdd-PrinterInstalls a new printer.
PrintersRemove-PrinterUninstalls a printer.
Windows UpdateGet-WindowsUpdateChecks for available Windows updates (PSWindowsUpdate module).
Windows UpdateInstall-WindowsUpdateInstalls available Windows updates.
Windows UpdateUninstall-WindowsUpdateUninstalls a specific Windows update.
Hyper-VGet-HyperVVMViews Hyper-V virtual machines (alias context for Get-VM).
Hyper-VGet-VMDisplays information about VMs on Hyper-V hosts.
Hyper-VNew-VMCreates a new virtual machine on a Hyper-V host.
Hyper-VStart-VMStarts a virtual machine.
Hyper-VStop-VMStops a virtual machine.
Hyper-VRemove-VMRemoves a virtual machine.
RemotingEnter-PSSessionStarts an interactive session on a remote computer.
RemotingInvoke-CommandRuns a command or script block on one or more remote computers.
Power & PolicyRestart-ComputerRestarts the local or a remote computer.
Power & PolicyStop-ComputerShuts down the local or a remote computer.
Power & PolicySet-ExecutionPolicyChanges the PowerShell script execution policy.
Power & PolicySet-ServiceModifies the startup type or status of a service.

Core Language Concepts

Verb-Noun Naming

Every cmdlet follows a strict Verb-Noun pattern (Get-Process, Set-Service) — run Get-Verb to see the full list of approved verbs, so a cmdlet's behavior is guessable from its name alone.

Objects, Not Text

PowerShell's pipeline passes real .NET objects between cmdlets, not plain text — Get-Process | Sort-Object CPU sorts by an actual numeric property, no text-parsing required like in a traditional shell.

The Pipeline (|)

Chains cmdlets so each one's output objects become the next one's input — Get-Service | Where-Object Status -eq 'Running' | Select-Object Name reads left to right as one continuous filter.

Providers & PSDrives

PowerShell exposes the filesystem, registry, certificate store, and more through the same drive-letter-like interface — cd HKLM:\ navigates the registry exactly like navigating C:\.

Modules

Cmdlets are packaged in modules (ActiveDirectory, Hyper-V, NetSecurity) — Import-Module loads one explicitly, though most modern modules auto-load on first use of one of their cmdlets.

Profile Scripts

$PROFILE points to a script that runs on every new session — the standard place to define personal aliases, functions, and module imports.

Common Parameters

-WhatIf

Preview without executing

-Confirm

Prompt before each action

-Verbose

Show extra diagnostic output

-ErrorAction

SilentlyContinue, Stop, etc.

Syntax Quick Reference

Syntax Purpose
$var = "value"Declares a variable — no type declaration required.
if ($x -eq 1) { }Conditional — comparison operators are word-based (-eq, -ne, -gt, -lt), not symbols.
foreach ($i in $items) { }Loops over a collection.
function Get-Thing { param($Name) ... }Defines a custom function, itself following Verb-Noun convention.
try { } catch { }Error handling — catches terminating errors thrown in the try block.
$obj.PropertyDot notation to access an object's property, same as most OOP languages.
"text $var here"Double-quoted strings interpolate variables; single-quoted strings don't.

Getting Comfortable Fast

The habits that make PowerShell's huge cmdlet surface actually discoverable, rather than something to memorize.

1

Use Tab completion aggressively

Type a partial cmdlet or parameter name and press Tab (or Ctrl+Space for a menu) — PowerShell completes cmdlet names, parameters, file paths, and even enum values like service status.

2

Get-Help -Examples before guessing syntax

Get-Help Get-ADUser -Examples shows real, runnable usage patterns — far faster than reconstructing correct parameter syntax from the full help page.

3

Get-Member reveals what an object actually has

Get-Process | Get-Member lists every property and method on the objects flowing through the pipeline — the fastest way to discover what you can filter, sort, or select on.

4

Test with -WhatIf before running a bulk change

Any cmdlet that supports it (most Set-/Remove-/New- cmdlets) can preview exactly what it would do — run once with -WhatIf, review the output, then run for real.

Quick Tips

Understand execution policy before fighting it
"Running scripts is disabled" is Set-ExecutionPolicy's default, a safety speed bump — not real security. RemoteSigned is the common sensible default for an admin workstation, not Unrestricted.
Invoke-Command scales better than Enter-PSSession
Enter-PSSession is for interactive one-at-a-time work; Invoke-Command -ComputerName (server1,server2,server3) runs the same script block against many machines in parallel — the real automation workhorse.
ISE is deprecated — use VS Code with the PowerShell extension
PowerShell ISE only supports Windows PowerShell 5.1, not PowerShell 7+ — Microsoft's own guidance is VS Code with the PowerShell extension for anything current.
Aliases are for the console, not for scripts
ls, cat, % (ForEach-Object), and ? (Where-Object) are convenient interactively, but full cmdlet names in saved scripts stay readable to someone without the same alias muscle memory.
Never hardcode credentials in a script
Use Get-Credential for an interactive prompt, or a proper secrets store (SecretManagement module, Azure Key Vault) for automation — a plaintext password in a .ps1 file is a real, common audit finding.
RSAT provides the AD/DNS/DHCP cmdlets on a workstation
The ActiveDirectory module isn't built into Windows client OSes by default — install Remote Server Administration Tools (RSAT) to manage AD from a regular admin workstation instead of RDPing into a DC.
Total Cmdlets: 0
Category Cmdlet Description
ConnectConnect-ExchangeOnlineConnects the session to Exchange Online — the first command run in any script or interactive session.
MailboxesGet-MailboxRetrieves one or more mailbox objects and their properties.
MailboxesSet-MailboxModifies mailbox properties — quotas, forwarding, permissions defaults, and more.
MailboxesNew-MailboxCreates a new user, shared, or resource mailbox.
MailboxesRemove-MailboxDeletes a mailbox — soft-deleted and recoverable for the retention window by default.
MailboxesGet-MailboxStatisticsShows mailbox size, item count, and last logon time — the standard "how big is this mailbox" check.
PermissionsGet-MailboxPermissionLists who has delegate access (Full Access, Send As, etc.) to a mailbox.
PermissionsAdd-MailboxPermissionGrants a user delegate access to another mailbox.
Distribution GroupsGet-DistributionGroupLists distribution groups and their settings.
Distribution GroupsNew-DistributionGroupCreates a new distribution or mail-enabled security group.
Distribution GroupsAdd-DistributionGroupMemberAdds a member to a distribution group.
Distribution GroupsGet-DistributionGroupMemberLists the current members of a distribution group.
Mail FlowGet-TransportRuleLists mail flow rules (transport rules) applied to messages in transit.
Mail FlowNew-TransportRuleCreates a new mail flow rule — e.g. adding a disclaimer or blocking an attachment type.
Mail FlowGet-MessageTraceTraces a message's delivery path — the standard first step for "did this email arrive" tickets.
MailboxesGet-MailboxAutoReplyConfigurationReads a mailbox's automatic-reply (out-of-office) settings.
MailboxesSet-MailboxAutoReplyConfigurationSets a mailbox's automatic-reply message and schedule — useful for setting OOO on behalf of a user.
MailboxesGet-CalendarProcessingReads a resource mailbox's calendar booking settings (auto-accept, conflict handling).
MailboxesGet-InboxRuleLists a mailbox's inbox rules — useful for auditing suspicious auto-forwarding after a compromise.
DevicesGet-MobileDeviceLists mobile devices connected to a mailbox via ActiveSync.
DevicesGet-ActiveSyncDeviceStatisticsShows sync status and last-connected time for a mobile device.
Org SettingsGet-OrganizationConfigShows tenant-wide Exchange Online configuration settings.
Org SettingsGet-AcceptedDomainLists domains the tenant accepts mail for.
Org SettingsGet-RemoteDomainShows settings for mail sent to a specific external domain.
ConnectDisconnect-ExchangeOnlineCloses the Exchange Online session and removes the imported temporary module.
Total Cmdlets: 0
Category Cmdlet Description
ConnectConnect-AzAccountSigns in to Azure — the first command in any Az module session.
SubscriptionsGet-AzSubscriptionLists Azure subscriptions the signed-in account can access.
SubscriptionsSet-AzContextSwitches the active subscription/tenant for subsequent commands.
Resource GroupsGet-AzResourceGroupLists resource groups in the current subscription.
Resource GroupsNew-AzResourceGroupCreates a new resource group in a chosen region.
Resource GroupsRemove-AzResourceGroupDeletes a resource group and everything inside it — irreversible.
Virtual MachinesGet-AzVMLists virtual machines and their properties.
Virtual MachinesNew-AzVMProvisions a new virtual machine.
Virtual MachinesStart-AzVMStarts a stopped/deallocated VM.
Virtual MachinesStop-AzVMStops a VM — add -StayProvisioned to stop without deallocating (still billed for compute).
Virtual MachinesRestart-AzVMRestarts a running VM.
StorageGet-AzStorageAccountLists storage accounts in the subscription.
StorageNew-AzStorageAccountCreates a new storage account.
Key VaultGet-AzKeyVaultLists Key Vaults accessible to the current account.
Key VaultGet-AzKeyVaultSecretRetrieves a secret stored in a Key Vault.
Key VaultSet-AzKeyVaultSecretCreates or updates a secret in a Key Vault.
Entra IDConnect-MgGraphConnects to Microsoft Graph — the modern replacement for the retired AzureAD module.
Entra IDGet-MgUserRetrieves Entra ID (Azure AD) user information via Graph.
Entra IDNew-MgUserCreates a new Entra ID user account.
Entra IDGet-MgGroupRetrieves Entra ID group information.
Entra IDGet-MgGroupMemberLists members of an Entra ID group.
Entra IDNew-MgGroupMemberAdds a member to an Entra ID group.
Access ControlGet-AzRoleAssignmentLists Azure RBAC role assignments for a user, group, or scope.
Access ControlNew-AzRoleAssignmentGrants an RBAC role to a principal at a chosen scope.
ConnectDisconnect-AzAccountSigns out of the current Azure session.

Covers both Microsoft's official SqlServer module and dbatools, the community module most working SQL Server DBAs actually reach for day to day.

Total Cmdlets: 0
Category Cmdlet Description
SqlServerInvoke-SqlcmdRuns a T-SQL script or query and returns the results as objects.
SqlServerGet-SqlInstanceRetrieves a SQL Server instance object for further inspection via the SQLSERVER: provider.
SqlServerGet-SqlDatabaseLists databases on an instance and their properties.
SqlServerBackup-SqlDatabasePerforms a full, differential, or log backup of a database.
SqlServerRestore-SqlDatabaseRestores a database from a backup file.
SqlServerGet-SqlAgentJobLists SQL Server Agent jobs and their schedules.
SqlServerStart-SqlAgentJobManually triggers a SQL Server Agent job to run immediately.
SqlServerGet-SqlLoginLists SQL Server logins on an instance.
SqlServerNew-SqlLoginCreates a new SQL Server login (SQL or Windows-authenticated).
SqlServerGet-SqlCredentialLists SQL Server credential objects used for external access (e.g. to Azure Storage).
SqlServerNew-SqlCredentialCreates a new SQL Server credential object.
dbatoolsConnect-DbaInstancedbatools' connection cmdlet — returns a rich SMO object most other dbatools cmdlets accept as input.
dbatoolsGet-DbaDatabaseLists databases with far more detail (size, recovery model, last backup) than the native module in one call.
dbatoolsBackup-DbaDatabaseA more flexible backup cmdlet than the native one — supports compression, striping, and cloud targets.
dbatoolsRestore-DbaDatabaseRestores a database, and can auto-detect the correct backup chain from a folder of files.
dbatoolsTest-DbaConnectionDiagnoses connectivity to a SQL Server instance — network, auth, and service-level checks in one command.
dbatoolsGet-DbaDbUserLists database-level users (as opposed to server-level logins) in a database.
dbatoolsInvoke-DbaQuerydbatools' version of Invoke-Sqlcmd — often preferred for its more consistent object output.
dbatoolsGet-DbaAgentJobLists SQL Server Agent jobs with richer status/history detail than the native cmdlet.