/
/

The Ultimate PowerShell Commands Cheat Sheet

PowerShell Commands Cheat Sheet blog banner image

With its user-friendly interface and versatile commands, Windows PowerShell is a useful tool for system administrators. It offers an extensive library of commands that allow you to automate repetitive tasks while offering the ability to execute commands remotely on multiple computers simultaneously. As a result, PowerShell helps increase productivity and reduce manual errors, and you can learn how to increase efficiency through our PowerShell commands cheat sheet below.

Reasons to use PowerShell

One of PowerShell’s advantages is its efficient command-line interface (CLI). While the graphical user interfaces (GUIs) often used for managing Windows can be handy for performing certain simple tasks, GUIs often fall short when automating complex administrative tasks or managing large-scale environments. PowerShell and its CLI, on the other hand, are faster and more efficient than a GUI, and let you operate with greater precision using fewer system resources. 

PowerShell also automates repetitive tasks, performs bulk operations, and easily manages remote systems. By opting to use PowerShell for network operations, you can save time and effort when managing your Windows infrastructure.

Extend your PowerShell toolkit by executing custom scripts on devices with NinjaOne.

See how NinjaOne script deployment works.

How PowerShell syntax works

PowerShell commands, also known as cmdlets, follow a verb-noun pattern. The verb represents the action you want to perform, and the noun represents the target of the action. 

For example, the command Get-Process retrieves information about running processes on your system. PowerShell also supports the use of parameters, which allow you to modify the behavior of a command. Parameters are specified using a hyphen followed by the parameter name and value, such as -Name “PowerShell.exe”. Familiarizing yourself with PowerShell’s syntax will make writing and understanding commands easier.

Essential PowerShell commands for everyday use

While there are many cmdlets available in PowerShell, there are some that you’ll use more regularly. Here are the 5 essential Windows PowerShell commands you should know:

  1. Get-Service: This command retrieves information about the services running on your system. Use it to check the status of a specific service, restart multiple services at once, or start or stop a service. For example, type Get-Service -Name “Print Spooler” to display the status of the Print Spooler service.
  2. Get-Process: With this command, you can retrieve information about the processes running on your system. It allows you to view the process ID, CPU usage, memory consumption, and other details. See this command in action by typing Get-Process -Name “notepad” to display information about all instances of the Notepad process.
  3. Get-EventLog: This command allows you to access the Windows event logs and retrieve information about events that have occurred on your system. You can filter events based on various criteria such as the event ID, source, or time range. Use it by typing Get-EventLog -LogName “Application” -After (Get-Date).AddDays(-1) to display the application events that occurred in the last 24 hours.
  4. Set-ExecutionPolicy: PowerShell has a built-in security feature that prevents the execution of scripts by default. This command allows you to modify the execution policy to enable or disable script execution. For example, you can allow scripts downloaded from the internet to execute by typing Set-ExecutionPolicy -ExecutionPolicy RemoteSigned.
  5. Test-Connection: This command allows you to check the connectivity between your computer and a remote computer or network device. It sends ICMP echo request packets (commonly known as ping) to the target computer and displays the results. To execute it, type Test-Connection -ComputerName “google.com” and it will test the connectivity to Google’s servers.

The essential PowerShell commands cheat sheet

In addition to the 5 essential commands above, we’ve compiled a list of other commonly used commands. Here is the essential Windows PowerShell commands cheat sheet:

CommandDescription
Get-ServiceRetrieve information about services
Get-ProcessRetrieve information about processes
Get-EventLogRetrieve information from event logs
Set-ExecutionPolicyModify the script execution policy
Test-ConnectionTest the connectivity to a remote computer
Out-FileWrite PowerShell output to a file
Get-HelpDisplay information about concepts and commands
Get-HistoryRetrieve recent commands in your current session
Get-CommandRetrieve all available PowerShell commands
ConvertTo-HTMLCreate an HTML file from PowerShell output
Copy-ItemCopy a file to a specific location
Clear-HistoryClear entries from your command history
Add-HistoryAdd entries to your command history
Format-TableFormat PowerShell output as a table
Format-ListFormat PowerShell output as a list
Clear-ContentRetain an item while deleting the contents of that item
Checkpoint-ComputerSet a restore point on your machine
ForEach-ObjectPerform an operation on each item in a specified group
Where-ObjectSelect objects with a certain property  
Select-ObjectSelect specific properties of an object or group of objects
Out-FileCreate a local file to save cmdlet output
Write-ProgressDisplay a progress bar in a PowerShell window
Debug-ProcessAttach a debugger to a running process
Get-WinEventDisplay Windows event logs
Wait-JobSuppress the command prompt until background jobs finish running

Keep this Windows PowerShell commands cheat sheet handy and refer to it whenever you need to perform common administrative tasks.

You might also find our PowerShell Error Handling Guide helpful.

PowerShell commands cheat sheet: Additional resources

The cheat sheet above covers some of the PowerShell commands you’ll need for common operations. For additional commands, take a look at these PowerShell resources:

  • Microsoft documentation: The official Microsoft documentation provides comprehensive information about Windows PowerShell, including a complete list of cmdlets, detailed examples, and best practices.
  • PowerShell gallery: PowerShell Gallery is a community-driven repository of PowerShell modules and scripts. You can find a wide range of pre-built cmdlets and scripts to help you automate common administrative tasks.
  • Online communities: Engaging with online communities such as forums, blogs, and social media platforms can be a great way to learn from other PowerShell users. You can ask questions, share your knowledge, and stay updated with the latest developments in the PowerShell community.
  • NinjaOne’s script library: NinjaOne offers detailed, step-by-step instructions for many PowerShell operations. See the entire NinjaOne Window PowerShell command library.

NinjaOne’s Script Hub empowers you to move beyond PowerShell cheat sheets with pre-built scripts for automation.

Browse the Script Hub library.

Next-level IT automation with NinjaOne

This PowerShell commands cheat sheet only scratches the surface of how PowerShell can help you manage Windows effectively. In a complex IT environment, PowerShell combined with NinjaOne’s IT automation tools can save your IT department time by automating resource-heavy, multi-step tasks. Start your free trial of NinjaOne and find out why it is the #1 IT Management software on G2.

You might also like

Ready to simplify the hardest parts of IT?