PowerShell Cheat Sheet

PowerShell is a command-line shell and scripting language that is designed for system administrators and power users. It is a powerful tool that allows you to automate tasks, manage systems, and perform complex operations with ease. PowerShell commands are the building blocks of PowerShell scripts, and they allow you to interact with the operating system and other applications.

PowerShell commands are called cmdlets, and they follow a consistent naming convention. Cmdlets are designed to be easy to use and understand, and they are typically composed of a verb and a noun. For example, the Get-Process cmdlet retrieves information about running processes on your system, while the Set-Item cmdlet sets the value of a registry key or file system object.

This cheat sheet provides an extensive list of PowerShell commands and their descriptions. The commands are divided into different categories for easy reference.

Basic Commands

CommandDescription
Get-CommandLists all available commands in PowerShell
Get-HelpDisplays help information for a command
Get-AliasLists all aliases for commands
Clear-HostClears the PowerShell console
ExitExits the PowerShell console

Navigation Commands

CommandDescription
Set-LocationChanges the current location in the file system
Get-LocationDisplays the current location in the file system
Push-LocationAdds the current location to a stack
Pop-LocationRemoves the most recent location from the stack
New-ItemCreates a new item in the file system
Remove-ItemDeletes an item from the file system
Copy-ItemCopies an item from one location to another
Move-ItemMoves an item from one location to another
Rename-ItemRenames an item in the file system

File and Folder Commands

CommandDescription
Get-ChildItemLists all items in a directory
Get-ItemGets an item in the file system
Get-ContentGets the content of a file
Set-ContentSets the content of a file
Add-ContentAdds content to a file
Select-StringSearches for a string in a file
Test-PathTests whether a path exists
Join-PathJoins two paths together
Split-PathSplits a path into its components

Process and Service Commands

CommandDescription
Get-ProcessLists all running processes
Stop-ProcessStops a running process
Start-ProcessStarts a new process
Get-ServiceLists all services
Stop-ServiceStops a running service
Start-ServiceStarts a stopped service

Network Commands

CommandDescription
Test-NetConnectionTests a network connection
PingPings a network address
Resolve-DnsNameResolves a DNS name
Get-NetAdapterLists all network adapters
Get-NetIPAddressLists all IP addresses
Get-NetRouteLists all network routes

User and Group Commands

CommandDescription
Get-LocalUserLists all local users
New-LocalUserCreates a new local user
Remove-LocalUserRemoves a local user
Get-LocalGroupLists all local groups
New-LocalGroupCreates a new local group
Remove-LocalGroupRemoves a local group
Add-LocalGroupMemberAdds a user to a local group
Remove-LocalGroupMemberRemoves a user from a local group

Registry Commands

CommandDescription
Get-ItemPropertyGets a property of a registry key
Set-ItemPropertySets a property of a registry key
New-ItemPropertyCreates a new property of a registry key
Remove-ItemPropertyRemoves a property of a registry key
Get-ChildItemLists all items in a registry key
New-ItemCreates a new registry key
Remove-ItemRemoves a registry key

Conclusion

This PowerShell cheat sheet provides an extensive list of commands and their descriptions. It is a useful reference for anyone working with PowerShell.

Reference:

https://learn.microsoft.com/en-us/powershell/