Common Helpdesk PowerShell Commands Last updated
Nov 14, 2023
Here is a small collection of PowerShell commands that might be helpful to any user administrators or helpdesk or service delivery technicians.
ComputersThese commands are related to interacting with workstations and servers.
Get Serial Number of a Computer1
( Get-CimInstance -Class Win32_BIOS ). SerialNumber
Rename Computer1
Rename-Computer -NewName YourNewName -Restart -Force
Join Computer to Domain1
Add-Computer -Credential ( Get-Credential ) -DomainName YourDomain . com -Restart -Force
Restart Computer1
Restart-Computer -Force
Empty Recycle Bin1
Clear-RecycleBin -DriveLetter C -Force
You can also select specific computer information, such as uptime, by specifying that property in the -Properties
parameter:
1
Get-ComputerInfo -Property OsUptime
Get ServicesList all services:
1
Get-Service | Format-Table -AutoSize
Get details of a specific service:
1
Get-Service -Name NameOfService | Select-Object * | Format-Table -AutoSize
Group Policy UpdateForce a group policy client update (this must be run from somewhere where the Remote Server Administration Tools (RSAT) are installed):
1
Invoke-GPUpdate -ComputerName workstation01 -Force
This is the same as using gpupdate /force
in Command Prompt.
Get the resulting applied group policies of the workstation/user:
1
Get-GPResultantSetOfPolicy -Computer workstation01 -User username -ReportType Html -Path "C:\temp\gpresult.html)"
This is the same as using gpresult /h C:\temp\gpresult.html
in Command Prompt.
Workstation Trust RelationshipsTo check if the workstation’s trust with the domain has failed, use:
1
Test-ComputerSecureChannel
If everything is okay, this should return True
. If it returns False
, then the workstation has lost its trust relationship with the domain. You can attempt to resolve this by using:
1
Test-ComputerSecureChannel -Repair
I recommend resetting the computer account in Active Directory before performing this step.
Run a Command On A Remote ComputerAs you can imagine, it can be helpful to run a command on a remote computer, whether it is to restart that computer, get it’s information, etc.
1
Invoke-Command -ComputerName server01 -ScriptBlock { your_command_goes_here }
Get Local Users UsersThese commands are related to interacting with users.
Unlock Domain User Account1
Unlock-ADAccount -Identity UserName
Reset Domain User Password1
Set-ADAccountPassword UserName -NewPassword ( Read-Host "Enter the new password" -AsSecureString ) – Reset
Add Domain User to Domain Group1
Add-ADGroupMember -Identity GroupName -Members UserName
NetworkingThese commands are related to networking on a computer.
Get Network Adapters1
Get-NetAdapter | Format-Table -AutoSize
Get IP Addresses1
Get-NetIPAddress | Format-Table -AutoSize
Flush DNS CacheThis is the same as doing ipconfig /flushdns
in Command Prompt.
Use a Specific Domain Name Suffix1
Set-DnsClient -InterfaceAlias YourInterfaceAlias -ConnectionSpecificSuffix YourDomain . com
Set DNS Servers1
Set-DnsClient -InterfaceIndex -ServerAddresses ( "dns1.yourdomain.com" , "dns2.yourdomain.com" )
Check out
Better than Just Pinging
Better than Just Pinging
I'm sure we have all pinged something during troubleshooting at one point or another. But what if, in the same...
5/7/2025
as well.
PrintersCheck out
Administer Windows Core Print Servers
Administer Windows Core Print Servers
Administer Windows Core Print Servers
You RDP to a print server and where you expected to see a Windows Server desktop...
5/7/2025
, as the commands described there are relevant in general.
Clipboard ManagementFor most commands, you can take the output and copy it to your clipboard using Set-Clipboard
. As an example, let’s get the computer information and copy it:
1
Get-ComputerInfo | Out-String | Set-Clipboard
Get what is stored in your clipboard:
ConclusionThere are so many helpful commands, as PowerShell is a powerful method of Windows administration. I hope some of these are helpful to someone! As always, you should fully understand what a command or script does before running it in your environment. Taking the time to learn how to use the terminal to administer your users and workstations will, over time, save you quite a bit of time.