cmd.exe PowerShell 7.x · Windows Server Troubleshooting

CMD PowerShell 7

Every classic CMD troubleshooting command — network, processes, services, disk, events, AD — mapped to its modern PowerShell 7.x equivalent. Structured, structured, scriptable, object-output.

Deprecated
ipconfig /all
Modern PS7
Get-NetIPConfiguration -Detailed
Deprecated
netstat -ano
Modern PS7
Get-NetTCPConnection | Sort-Object State
Deprecated
sc query type= all
Modern PS7
Get-Service | Where-Object Status -eq Running
cmd.exe retiring PS 7.4 LTS Windows Server 2022 Object output Pipeline-ready Remote-capable
SETUP

Installing & Configuring PowerShell 7 on Windows Server

⬇️ Installation Methods
W
WinGet (recommended) — available on Server 2022+. Fastest install method.
# Install PS7 via WinGet winget install --id Microsoft.PowerShell --source winget
M
MSI installer — download from GitHub releases. Needed for older Server 2016/2019 without WinGet. github.com/PowerShell/PowerShell/releases — PowerShell-7.x.x-win-x64.msi
S
One-line installer (run as Admin) — installs latest stable.
Invoke-Expression "& { $(Invoke-RestMethod aka.ms/install-powershell.ps1) }"
C
SCCM / Intune — deploy MSI silently across fleet. msiexec /i PowerShell-7.x.x-win-x64.msi /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1
⚙️ Post-Install Configuration
Ex
Set execution policy — RemoteSigned for scripts from trusted sources.
# Set policy (run as Admin in PS7) Set-ExecutionPolicy RemoteSigned -Scope LocalMachine Get-ExecutionPolicy -List
M
Import Windows-specific modules — PS7 doesn't auto-load Windows PowerShell modules.
# Import ActiveDirectory and ServerManager Import-Module ActiveDirectory Import-Module ServerManager Get-Module -ListAvailable
V
Verify version and check PS7 vs Windows PS
# Launch PS7: pwsh.exe (not powershell.exe) $PSVersionTable # shows 7.x $PSVersionTable.PSEdition # "Core" = PS7 # "Desktop" = Windows PowerShell 5.1
📊 CMD vs Windows PS 5.1 vs PowerShell 7 — Key Differences
FeatureCMD.exePowerShell 5.1 (Desktop)PowerShell 7.x (Core)
Output typeText only.NET objects.NET objects + cross-platform
PipelineText stringsStructured objectsStructured objects, ForEach-Parallel
Cross-platformWindows onlyWindows onlyWindows · Linux · macOS
Error handling%ERRORLEVEL%Try/CatchTry/Catch + $? + $Error
RemotingPSExec (3rd party)WinRM / WSManWinRM + SSH remoting
JSON/REST supportNoneInvoke-RestMethodNative JSON + Invoke-RestMethod
Support lifecycleLegacy — no new featuresMaintenance only (EOL track)Actively developed — LTS available
Launch binarycmd.exepowershell.exepwsh.exe
NETWORK

Network Diagnostics

CMDPS7NetTCPIP module · Get-Net* cmdlets · Test-NetConnection
🌐 IP Configuration — ipconfig
deprecated / text output
ipconfig ipconfig /all ipconfig /release ipconfig /renew ipconfig /flushdns ipconfig /displaydns ipconfig /registerdns
object output · filterable
Get-NetIPConfiguration Get-NetIPConfiguration -Detailed Remove-NetIPAddress -InterfaceAlias "Ethernet" Set-NetIPInterface -InterfaceAlias "Ethernet" -Dhcp Enabled Clear-DnsClientCache Get-DnsClientCache Register-DnsClient
📡 Ping & Connectivity Tests
deprecated / limited
ping google.com ping -n 10 -l 1500 server01 ping -t server01 tracert server01 pathping server01 telnet server01 443
returns objects · port-aware
Test-Connection google.com Test-Connection server01 -Count 10 -BufferSize 1500 Test-Connection server01 -Repeat Test-NetConnection server01 -TraceRoute Test-NetConnection server01 -TraceRoute -Hops 30 Test-NetConnection server01 -Port 443
🔌 Network Connections — netstat
deprecated / text only
netstat -ano netstat -b netstat -an | findstr :443 netstat -rn
full object · process-linked
Get-NetTCPConnection | Sort-Object State Get-NetTCPConnection | Select LocalAddress,LocalPort,RemoteAddress,RemotePort,State,@{N='Proc';E={(Get-Process -Id $_.OwningProcess).Name}} Get-NetTCPConnection -LocalPort 443 Get-NetRoute -AddressFamily IPv4
🔗 ARP & MAC Address
deprecated
arp -a arp -d * getmac /v
Get-NetNeighbor -AddressFamily IPv4 Remove-NetNeighbor -AddressFamily IPv4 -Confirm:$false Get-NetAdapter | Select Name, MacAddress, LinkSpeed, Status
🛣️ Routing Table — route
deprecated
route print route add 10.10.0.0 mask 255.255.0.0 192.168.1.1 route delete 10.10.0.0 route change ...
Get-NetRoute -AddressFamily IPv4 New-NetRoute -DestinationPrefix "10.10.0.0/16" -NextHop "192.168.1.1" -InterfaceIndex 5 Remove-NetRoute -DestinationPrefix "10.10.0.0/16" Set-NetRoute -DestinationPrefix "10.10.0.0/16" -RouteMetric 25
DNS

DNS Troubleshooting

nslookup / ipconfigResolve-DnsName · DnsClient module
🔍 DNS Lookups — nslookup
deprecated / interactive mode
nslookup google.com nslookup -type=A google.com nslookup -type=MX google.com nslookup -type=SRV _ldap._tcp.domain.com nslookup 10.0.0.1 nslookup google.com 8.8.8.8 ipconfig /flushdns ipconfig /displaydns
structured output · server-selectable
Resolve-DnsName google.com Resolve-DnsName google.com -Type A Resolve-DnsName google.com -Type MX Resolve-DnsName _ldap._tcp.domain.com -Type SRV Resolve-DnsName 10.0.0.1 # reverse lookup Resolve-DnsName google.com -Server 8.8.8.8 Clear-DnsClientCache Get-DnsClientCache
🖥️ DNS Server Management (Windows DNS Role)
dnscmd deprecated
dnscmd /enumzones dnscmd /enumrecords zone.com @ dnscmd /recordadd zone.com host A 10.0.0.5 dnscmd /recorddelete zone.com host A dnscmd /statistics
DnsServer module · pipeline-friendly
Get-DnsServerZone Get-DnsServerResourceRecord -ZoneName zone.com Add-DnsServerResourceRecordA -ZoneName zone.com -Name host -IPv4Address 10.0.0.5 Remove-DnsServerResourceRecord -ZoneName zone.com -Name host -RRType A -Force Get-DnsServerStatistics
PROCESS

Process Management

tasklist / taskkillGet-Process · Stop-Process · Start-Process
📋 List & Find Processes
deprecated / text only
tasklist tasklist /FI "IMAGENAME eq notepad.exe" tasklist /FI "MEMUSAGE gt 100000" tasklist /SVC tasklist /V wmic process list full
objects · sortable · filterable
Get-Process Get-Process -Name notepad Get-Process | Where-Object {$_.WorkingSet -gt 100MB} | Sort-Object WorkingSet -Descending Get-Process | Select Name, Id, CPU, WorkingSet, Modules Get-Process | Select -First 20 | Format-Table -AutoSize Get-CimInstance Win32_Process | Select Name,ProcessId,CommandLine,ParentProcessId
⛔ Kill Processes & Start New
deprecated
taskkill /PID 1234 /F taskkill /IM notepad.exe /F taskkill /IM notepad.exe /T /F start notepad.exe start /wait setup.exe
Stop-Process -Id 1234 -Force Stop-Process -Name notepad -Force Get-Process notepad | Stop-Process -Force # includes children via pipeline Start-Process notepad.exe Start-Process setup.exe -Wait
⚙️ Top Processes by CPU / Memory
no direct equivalent in CMD
# CMD had no easy equivalent # Had to open Task Manager GUI # or use wmic (also deprecated): wmic process get Name,ProcessId, WorkingSetSize /format:csv
real-time monitoring
# Top 10 by CPU Get-Process | Sort-Object CPU -Descending | Select -First 10 # Top 10 by memory (MB) Get-Process | Sort-Object WorkingSet -Descending | Select Name,Id,@{N='RAM_MB';E={[math]::Round($_.WorkingSet/1MB,1)}} | Select -First 10 # Continuous watch (refresh every 3s) while($true){ Get-Process | Sort-Object CPU -Desc | Select -First 5; Start-Sleep 3; Clear-Host }
SERVICES

Windows Services

sc / net start / net stopGet-Service · Start-Service · Set-Service
🔧 Service Control
deprecated / text output
sc query sc query type= all state= all sc query wuauserv net start wuauserv net stop wuauserv sc stop wuauserv sc start wuauserv sc config wuauserv start= auto sc config wuauserv start= disabled sc delete badservice
objects · remote-capable
Get-Service Get-Service | Select Name, DisplayName, Status, StartType Get-Service wuauserv Start-Service wuauserv Stop-Service wuauserv Stop-Service wuauserv Start-Service wuauserv Set-Service wuauserv -StartupType Automatic Set-Service wuauserv -StartupType Disabled Remove-Service badservice # PS7 only (not in PS5)
🔍 Find Stopped / Failed Services
deprecated / pipe to findstr
sc query state= all | findstr "STOPPED" sc query type= all | findstr STATE # No easy way to filter by startup type # or correlate with dependent services
rich filtering + dependencies
# All stopped services that should be running Get-Service | Where-Object {$_.Status -eq 'Stopped' -and $_.StartType -eq 'Automatic'} # Restart all stopped auto-start services Get-Service | Where-Object {$_.Status -eq 'Stopped' -and $_.StartType -eq 'Automatic'} | Start-Service -PassThru # Show service dependencies Get-Service wuauserv | Select -ExpandProperty DependentServices
DISK

Disk & Storage Troubleshooting

diskpart / chkdsk / dir / fsutilGet-Disk · Get-Partition · Get-Volume · Storage module
💾 Disk & Volume Information
deprecated / interactive diskpart
diskpart → list disk diskpart → list volume diskpart → list partition fsutil volume diskfree C: dir C:\ /s wmic logicaldisk get caption,size,freespace
Storage module · scriptable
Get-Disk Get-Volume Get-Partition Get-Volume | Select DriveLetter, FileSystem, Size, SizeRemaining, @{N='Free%';E={[math]::Round($_.SizeRemaining/$_.Size*100,1)}} Get-ChildItem C:\ -Recurse | Measure-Object -Property Length -Sum Get-PSDrive -PSProvider FileSystem
🔎 Find Large Files & Folders
deprecated / no size sort
dir /s /a /o:s C:\ forfiles /P C:\ /S /M * /C "cmd /c if @fsize GTR 104857600 echo @path" # forfiles is slow and limited
fast · size-aware
# Files over 1GB Get-ChildItem C:\ -Recurse -File -ErrorAction SilentlyContinue | Where-Object {$_.Length -gt 1GB} | Sort-Object Length -Descending | Select FullName, @{N='GB';E={[math]::Round($_.Length/1GB,2)}} | Select -First 20 # Folder sizes (top-level) Get-ChildItem C:\ -Directory | ForEach-Object { [PSCustomObject]@{Folder=$_.Name; SizeGB=[math]::Round((Get-ChildItem $_.FullName -Recurse -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum/1GB,2)} } | Sort-Object SizeGB -Descending
🔧 Disk Health & SMART
deprecated / limited output
chkdsk C: /f /r chkdsk C: # No SMART data from CMD without 3rd party # wmic diskdrive get status is deprecated
Repair-Volume -DriveLetter C -Scan Repair-Volume -DriveLetter C -OfflineScanAndFix Get-PhysicalDisk | Select FriendlyName, MediaType, OperationalStatus, HealthStatus, Size Get-StorageReliabilityCounter -PhysicalDisk (Get-PhysicalDisk)[0]
EVENTS

Event Log Querying

eventquery / wevtutilGet-WinEvent · Get-EventLog (also legacy)
📋 Query Event Logs
deprecated / wevtutil also being replaced
wevtutil qe System /c:10 /rd:true /f:text wevtutil qe Application /c:50 wevtutil cl System wevtutil el eventquery /L System /FI "Type eq Error"
full structured event objects
Get-WinEvent -LogName System -MaxEvents 10 Get-WinEvent -LogName Application -MaxEvents 50 Clear-EventLog -LogName System Get-WinEvent -ListLog * Get-WinEvent -FilterHashtable @{LogName='System'; Level=2} # Level 2 = Error
🔍 Advanced Event Filtering
no equivalent — CMD cannot do this
# CMD had no way to: # - Filter by event ID + time range # - Search message text # - Export to structured CSV # without GUI or third-party tools
FilterHashtable is fastest method
# Errors in last 24 hours Get-WinEvent -FilterHashtable @{ LogName='System'; Level=2 StartTime=(Get-Date).AddHours(-24) } # Specific Event ID (e.g., 4625 — failed logon) Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4625} -MaxEvents 50 # Search event message text Get-WinEvent -LogName System | Where-Object {$_.Message -like "*driver*"} | Select TimeCreated, Id, Message | Export-Csv "driver-events.csv" -NoTypeInformation # Critical events across all logs Get-WinEvent -FilterHashtable @{LogName='*'; Level=1} -MaxEvents 100
USERS

Local Users & Active Directory

net user / net localgroupLocalAccounts module · ActiveDirectory module
👤 Local Users & Groups
deprecated / text only
net user net user jdoe net user jdoe /add net user jdoe * net user jdoe /active:no net user jdoe /delete net localgroup net localgroup Administrators net localgroup Administrators jdoe /add
LocalAccounts module · objects
Get-LocalUser Get-LocalUser -Name jdoe New-LocalUser -Name jdoe -Password (Read-Host -AsSecureString) -FullName "John Doe" Set-LocalUser -Name jdoe -Password (Read-Host -AsSecureString) Disable-LocalUser -Name jdoe Remove-LocalUser -Name jdoe Get-LocalGroup Get-LocalGroupMember -Group Administrators Add-LocalGroupMember -Group Administrators -Member jdoe
🏢 Active Directory User Queries
deprecated / dsquery also deprecated
net user /domain jdoe dsquery user -name "John*" dsget user "CN=jdoe,..." -memberof net group "Domain Admins" /domain dsquery computer -inactive 4
ActiveDirectory module · LDAP-powered
Get-ADUser -Identity jdoe -Properties * Get-ADUser -Filter {Name -like "John*"} Get-ADUser -Identity jdoe -Properties MemberOf | Select -ExpandProperty MemberOf Get-ADGroupMember "Domain Admins" -Recursive Search-ADAccount -AccountInactive -TimeSpan 28.00:00:00 -ComputersOnly
REGISTRY

Registry Operations

reg query / reg add / regeditGet-ItemProperty · Set-ItemProperty · Registry PSDrive
🗂️ Registry Read & Write
deprecated / text output
reg query HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion reg query HKLM\SYSTEM\CurrentControlSet\Services reg add HKCU\Software\Test /v MyValue /t REG_SZ /d "Hello" reg delete HKCU\Software\Test /v MyValue /f reg export HKLM\SOFTWARE output.reg
HKLM:/HKCU: PSDrives · objects
Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" Get-ChildItem "HKLM:\SYSTEM\CurrentControlSet\Services" Set-ItemProperty -Path "HKCU:\Software\Test" -Name MyValue -Value "Hello" Remove-ItemProperty -Path "HKCU:\Software\Test" -Name MyValue reg export HKLM\SOFTWARE output.reg # still valid via reg.exe
FIREWALL

Windows Firewall

netsh advfirewallNetSecurity module · Get-NetFirewallRule
🔥 Firewall Rules & Status
netsh deprecated for firewall
netsh advfirewall show allprofiles netsh advfirewall show currentprofile netsh advfirewall firewall show rule name=all netsh advfirewall firewall add rule name="SSH" dir=in action=allow protocol=TCP localport=22 netsh advfirewall set allprofiles state off netsh advfirewall set allprofiles state on
NetSecurity module · full objects
Get-NetFirewallProfile Get-NetFirewallProfile -Name Domain Get-NetFirewallRule | Where-Object {$_.Enabled -eq $true} New-NetFirewallRule -DisplayName "Allow SSH" ` -Direction Inbound -Action Allow ` -Protocol TCP -LocalPort 22 Set-NetFirewallProfile -All -Enabled False Set-NetFirewallProfile -All -Enabled True
REMOTE

Remote Administration

psexec (3rd party) / wmic /nodeInvoke-Command · Enter-PSSession · New-PSSession
🖥️ Remote Command Execution
3rd party · deprecated wmic
psexec \\server01 ipconfig psexec \\server01 -u admin -p pass cmd wmic /node:server01 process list wmic /node:server01 service list wmic /node:server01 os get Caption # psexec requires install + risky # wmic deprecated in Win11/2022
built-in WinRM · encrypted · audited
Invoke-Command -ComputerName server01 -ScriptBlock {Get-NetIPConfiguration} Invoke-Command -ComputerName server01 -Credential (Get-Credential) -ScriptBlock {hostname} Invoke-Command -ComputerName server01 -ScriptBlock {Get-Process} Invoke-Command -ComputerName server01 -ScriptBlock {Get-Service} Invoke-Command -ComputerName server01 -ScriptBlock {Get-CimInstance Win32_OperatingSystem | Select Caption} # WinRM is built-in, encrypted, uses AD auth
💻 Interactive Remote Session
requires psexec / RDP
psexec \\server01 cmd.exe mstsc /v:server01 # GUI only # No built-in CLI remote shell
SSH (PS7) or WinRM · no 3rd party needed
Enter-PSSession -ComputerName server01 # WinRM Enter-PSSession -HostName server01 -UserName admin # SSH (PS7) Exit-PSSession # Persistent session for multiple commands $s = New-PSSession -ComputerName server01 Invoke-Command -Session $s -ScriptBlock {Get-Process} Invoke-Command -Session $s -ScriptBlock {Get-Service} Remove-PSSession $s # Run against multiple servers in parallel (PS7) Invoke-Command -ComputerName server01,server02,server03 -ScriptBlock {Get-HotFix | Sort-Object InstalledOn -Desc | Select -First 3}
PERF

Performance Monitoring

typeperf / perfmonGet-Counter · Get-CimInstance
📊 CPU, Memory & Disk Counters
deprecated / limited output
typeperf "\Processor(_Total)\% Processor Time" typeperf "\Memory\Available MBytes" typeperf "\LogicalDisk(C:)\% Free Space" wmic cpu get loadpercentage wmic os get freephysicalmemory
structured counters · continuous option
Get-Counter '\Processor(_Total)\% Processor Time' -SampleInterval 2 -MaxSamples 5 Get-Counter '\Memory\Available MBytes' Get-Counter '\LogicalDisk(C:)\% Free Space' Get-CimInstance Win32_Processor | Select Name, LoadPercentage Get-CimInstance Win32_OperatingSystem | Select FreePhysicalMemory, TotalVisibleMemorySize
🔍 System Health Snapshot
no single CMD equivalent
# Required multiple separate commands # and text parsing to get any # kind of aggregate view systeminfo # systeminfo slow (WMI calls on each run)
instant · scriptable · exportable
# One-shot health snapshot $os = Get-CimInstance Win32_OperatingSystem $cpu = Get-CimInstance Win32_Processor $cs = Get-CimInstance Win32_ComputerSystem [PSCustomObject]@{ OS = $os.Caption Uptime = (Get-Date) - $os.LastBootUpTime RAM_GB = [math]::Round($cs.TotalPhysicalMemory/1GB, 1) RAM_Free_GB = [math]::Round($os.FreePhysicalMemory/1MB, 1) CPU_Load = "$($cpu.LoadPercentage)%" CPU_Name = $cpu.Name Disk_Free = (Get-Volume C).SizeRemaining }
SYSINFO

System Information & OS Details

systeminfo / wmic / msinfo32Get-ComputerInfo · Get-CimInstance · Get-HotFix
💻 OS & Hardware Info
deprecated / all deprecated wmic
systeminfo systeminfo | findstr /B /C:"OS Name" wmic os get Caption,Version,BuildNumber wmic csproduct get Name,IdentifyingNumber wmic bios get SMBIOSBIOSVersion,Manufacturer wmic cpu get Name,NumberOfCores wmic memorychip get Capacity wmic qfe list hostname ver
Get-ComputerInfo is the modern all-in-one
Get-ComputerInfo Get-ComputerInfo | Select OsName, OsVersion, WindowsBuildLabEx Get-CimInstance Win32_OperatingSystem | Select Caption, Version, BuildNumber Get-CimInstance Win32_ComputerSystem | Select Name, Model, Manufacturer Get-CimInstance Win32_Bios | Select SMBIOSBIOSVersion, Manufacturer, ReleaseDate Get-CimInstance Win32_Processor | Select Name, NumberOfCores, NumberOfLogicalProcessors Get-CimInstance Win32_PhysicalMemory | Measure-Object Capacity -Sum Get-HotFix | Sort-Object InstalledOn -Descending hostname # still works in PS7 $PSVersionTable.PSVersion # PS version
🩹 Hotfixes & Windows Updates
deprecated / text parsing required
wmic qfe list brief wmic qfe get HotFixID,InstalledOn,Description wmic qfe where "HotFixID='KB5001567'" get HotFixID
Get-HotFix returns objects
Get-HotFix Get-HotFix | Sort-Object InstalledOn -Desc | Select -First 10 Get-HotFix -Id KB5001567 # Check specific KB across multiple servers Invoke-Command -ComputerName server01,server02 -ScriptBlock { Get-HotFix -Id KB5001567 -ErrorAction SilentlyContinue }
📋 Complete CMD → PS7 Quick Reference Table
CMD CommandPS7 EquivalentNotes
ipconfigGet-NetIPConfigurationFull object output + filterable
ipconfig /flushdnsClear-DnsClientCacheReturns nothing on success
pingTest-ConnectionReturns objects with RTT, source, target
tracertTest-NetConnection -TraceRouteAlso tests port connectivity
telnet host portTest-NetConnection -PortNo Telnet client needed
netstat -anoGet-NetTCPConnectionIncludes owning process ID natively
route printGet-NetRouteFilterable by address family
arp -aGet-NetNeighborARP + NDP table
nslookupResolve-DnsNameAll record types · server selectable
tasklistGet-ProcessObjects with CPU, memory, handles
taskkill /F /PIDStop-Process -Id -ForcePipeline-able
sc queryGet-ServiceStartType, DependentServices included
net start/stopStart-Service / Stop-ServiceUse -PassThru to verify
sc config start=Set-Service -StartupTypeAutomatic · Manual · Disabled
chkdsk /fRepair-Volume -DriveLetterOnline scan or offline fix
dir /sGet-ChildItem -RecurseFilter by extension, size, date
wevtutil qeGet-WinEvent -FilterHashtableFastest event query method
reg queryGet-ItemProperty HKLM:\...HKLM:/HKCU: are PSDrives
netsh advfirewallGet/New/Set-NetFirewallRuleFull NetSecurity module
net userGet-LocalUserLocalAccounts module
net localgroupGet-LocalGroup / Get-LocalGroupMemberAdd/Remove-LocalGroupMember
wmic os getGet-ComputerInfo / Get-CimInstance Win32_OSwmic fully deprecated Win11+
wmic qfe listGet-HotFixReturns full objects
systeminfoGet-ComputerInfoAll fields accessible as properties
gpupdate /forceInvoke-GPUpdate -Force (RSAT)gpupdate.exe still works in PS7
gpresult /rGet-GPResultantSetOfPolicy (RSAT)gpresult.exe still works