22 Useful PowerShell Commands for System Admins

3 min read James Futhey First published June 5, 2025
Smiling IT administrator holding a tablet in a data centre aisle

These are the 22 PowerShell cmdlets that come up most in day-to-day Windows and Microsoft 365 administration. The examples match the syntax on Microsoft Learn for PowerShell 7.5, Windows Server, Exchange Online, and Microsoft Graph.

Commands 1 to 20 ship with Windows PowerShell or PowerShell 7. Set-Place and Set-CalendarProcessing need the Exchange Online PowerShell module, and Get-MgPlaceAsRoom needs the Microsoft Graph PowerShell SDK.

1. Get-Process

Get-Process lists the processes running on the computer, with each one's name, ID, CPU time, and memory use. Use it to find what's using resources or to get a process ID before you stop it.

Get-Process | Sort-Object CPU -Descending | Select-Object -First 10

2. Get-Service

Get-Service shows each service and whether it's running or stopped. The Get-Service guide covers filtering and remote computers.

Get-Service | Where-Object Status -eq 'Stopped'

3. Get-Command

Get-Command finds the commands installed on the computer. The -Name parameter accepts wildcards, so you can search by part of a name.

Get-Command -Name *Service*

To list every cmdlet grouped by noun:

Get-Command -Type Cmdlet | Sort-Object -Property Noun | Format-Table -GroupBy Noun

4. Get-Member

Get-Member shows the properties and methods of the objects a command returns. Run it when you need the exact property name to filter or select on.

Get-Process | Get-Member

5. Select-Object

Select-Object keeps only the properties you name, or the first or last items in a list.

Get-Service | Select-Object Name, Status

6. Format-Table

Format-Table shows output as a table. -Property picks the columns and -AutoSize fits them to the data.

Get-Process | Format-Table -Property Name, Id, CPU -AutoSize

7. Get-ChildItem

Get-ChildItem lists the items in a folder, like dir. Add -Recurse to include subfolders. The Get-ChildItem guide has more examples.

Get-ChildItem -Path "C:\Users" -Filter "da*" -Name

8. Get-Content

Get-Content reads a file one line at a time. -Tail returns the last lines, which is the quickest way to check a log.

Get-Content "C:\Logs\error.log" -Tail 10

9. New-Item

New-Item creates a file or folder. -ItemType sets which one.

New-Item -Path "C:\Scripts\Logs" -ItemType Directory

10. Copy-Item

Copy-Item copies files and folders. -Recurse copies everything inside a folder, including subfolders.

Copy-Item "C:\Source" "D:\Backup" -Recurse

11. Invoke-Item

Invoke-Item opens a file or folder with its default app, the same as double-clicking it.

Invoke-Item "C:\Reports\processes.html"

12. Out-File

Out-File writes command output to a text file, for records or for comparing later.

Get-Service | Out-File -FilePath "C:\Reports\Services.txt"

13. ConvertTo-Html

ConvertTo-Html turns objects into an HTML table you can open in a browser or attach to an email.

Get-Process | ConvertTo-Html | Out-File "C:\Reports\processes.html"

14. Get-WinEvent

Get-WinEvent reads Windows event logs and event trace log files. Microsoft recommends it over the older Get-EventLog cmdlet.

Get-WinEvent -LogName System -MaxEvents 20

-FilterHashtable filters at the source, which is faster on large logs. This gets warnings from the Windows PowerShell log since yesterday:

$Yesterday = (Get-Date) - (New-TimeSpan -Day 1)
Get-WinEvent -FilterHashtable @{ LogName='Windows PowerShell'; Level=3; StartTime=$Yesterday }

15. Get-NetIPAddress

Get-NetIPAddress shows the IP address configuration of each network adapter. -AddressFamily limits it to IPv4 or IPv6.

Get-NetIPAddress -AddressFamily IPv4

To test whether a remote port answers, see Test-NetConnection.

16. Restart-Computer

Restart-Computer restarts the local computer or remote ones named with -ComputerName. With -Wait -For PowerShell, the command doesn't return until PowerShell is available on the remote computer again.

Restart-Computer -ComputerName Server01 -Wait -For PowerShell -Timeout 300 -Delay 2

17. Start-Process

Start-Process starts a program. -Verb RunAs starts it as administrator.

Start-Process notepad.exe -Verb RunAs

18. Set-ExecutionPolicy

Set-ExecutionPolicy controls whether PowerShell runs scripts and loads configuration files. The default is Restricted on Windows clients and RemoteSigned on Windows Server. RemoteSigned runs local scripts and requires downloaded scripts to be signed by a trusted publisher.

Set-ExecutionPolicy RemoteSigned

19. Get-History

Get-History lists the commands run in the current session, with an ID for each. Filter it to find a command you ran earlier:

Get-History | Where-Object {$_.CommandLine -like "*Service*"}

Invoke-History runs an entry again by its ID.

20. Set-Place

Set-Place updates the details that help people find a meeting room, such as building, floor, and capacity. It's part of the Exchange Online PowerShell module, not Microsoft Graph, and Microsoft recommends using it with the EXO V3 module. The Set-Place guide lists every property.

Set-Place -Identity "Conference Room 02" -Building "Building 02" -Capacity 5 -Floor 3

21. Set-CalendarProcessing

Set-CalendarProcessing controls how a room mailbox handles meeting requests: whether it accepts them automatically, how far ahead people can book, and whether it allows conflicts. It needs the Exchange Online module and permission to manage resource mailboxes. The Set-CalendarProcessing guide covers each setting.

Set-CalendarProcessing -Identity "boardroom@contoso.com" -AutomateProcessing AutoAccept -BookingWindowInDays 180 -AllowConflicts $false

22. Get-MgPlaceAsRoom

Get-MgPlaceAsRoom lists the rooms defined in your Microsoft 365 tenant through Microsoft Graph. It's in the Microsoft.Graph.Calendar module.

Import-Module Microsoft.Graph.Calendar
Get-MgPlaceAsRoom -All

Rooms that don't show in Outlook's Room Finder usually need a room list or Set-Place details. See Outlook Room Finder not showing rooms for the fix.

Add a display to your office

Every room, on the door.

Live availability on every meeting room. Works with Microsoft 365, Exchange and Google Workspace.