50 Windows Commands Every Azure VM Admin Needs (PowerShell + Active Directory)
Published: (December 12, 2025 at 01:47 PM EST)
2 min read
Source: Dev.to
Source: Dev.to
Why This List Exists
Azure Portal is great until:
- RDP is slow
- You need to fix networking
- Active Directory breaks
- You’re troubleshooting dozens of VMs
Then you need actual Windows commands.
Networking
Get-NetIPAddress | Format-Table InterfaceAlias, IPAddress, PrefixLength
Resolve-DnsName azure-noob.com -Server 8.8.8.8
tracert 10.0.1.4
Test-NetConnection -ComputerName 10.0.1.4 -Port 443
route print
ipconfig /flushdns
netstat -ano | findstr ESTABLISHED
Active Directory
Add-Computer -DomainName contoso.com -Credential (Get-Credential) -Restart
nltest /dsgetdc:contoso.com
repadmin /replsummary
Get-ADDomainController -Filter * | Select Name, IPv4Address
Reset-ComputerMachinePassword -Server DC01 -Credential (Get-Credential)
nltest /sc_query:contoso.com
Disk Management
Get-Disk | Format-Table Number, FriendlyName, Size, PartitionStyle
Initialize-Disk -Number 2 -PartitionStyle GPT
New-Partition -DiskNumber 2 -UseMaximumSize -DriveLetter F
Format-Volume -DriveLetter F -FileSystem NTFS -NewFileSystemLabel "Data"
Resize-Partition -DriveLetter C -Size (Get-PartitionSupportedSize -DriveLetter C).SizeMax
Get-PhysicalDisk | Select FriendlyName, HealthStatus, OperationalStatus
Service Management
Get-Service | Where-Object {$_.Status -eq "Running"} | Format-Table Name, DisplayName
Start-Service -Name "W32Time"
Stop-Service -Name "Spooler"
Set-Service -Name "wuauserv" -StartupType Manual
Get-Service -Name "W32Time" | Select -ExpandProperty DependentServices
Get-Service WSearch | Restart-Service
Performance & Monitoring
Get-Counter '\Processor(_Total)\% Processor Time' -SampleInterval 1 -MaxSamples 5
Get-WmiObject Win32_OperatingSystem |
Select @{N="FreeGB";E={[math]::Round($_.FreePhysicalMemory/1MB,2)}}
Get-Process | Sort-Object CPU -Descending | Select -First 10 Name, CPU, PM
Get-Counter '\PhysicalDisk(_Total)\Disk Reads/sec','\PhysicalDisk(_Total)\Disk Writes/sec'
(Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime
Windows Update
Get-WindowsUpdate
Install-WindowsUpdate -AcceptAll -AutoReboot
Get-WmiObject -Class Win32_QuickFixEngineering | Select HotFixID, InstalledOn
Local Users & Groups
Get-LocalGroupMember -Group "Administrators"
Add-LocalGroupMember -Group "Administrators" -Member "CONTOSO\john.doe"
query user
logoff 2 /server:localhost
File Permissions
Get-Acl C:\Important\File.txt | Format-List
Firewall
Get-NetFirewallRule | Where Enabled -eq $true | Select Name, DisplayName
New-NetFirewallRule -DisplayName "Allow SQL" -Direction Inbound -Protocol TCP -LocalPort 1433 -Action Allow
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled $false
Event Logs
Get-EventLog -LogName System -EntryType Error -Newest 20
Get-EventLog -LogName Application | Where-Object {$_.Message -like "*SQL*"}
Get-EventLog -LogName Security -InstanceId 4624 -Newest 10
Azure‑Specific Commands
Get-Service WindowsAzureGuestAgent
Invoke-RestMethod -Headers @{"Metadata"="true"} -Method GET -Uri "http://169.254.169.254/metadata/instance?api-version=2021-02-01"
Get-AzVMExtension -ResourceGroupName "RG-Prod" -VMName "VM-SQL-01"
System Information
Get-ComputerInfo | Select WindowsProductName, WindowsVersion, OsBuildNumber
Get-WmiObject -Class Win32_Product | Select Name, Version
Get-WindowsDriver -Online
Cleanup & Maintenance
net stop wuauserv
del C:\Windows\SoftwareDistribution\*.* /s /q
net start wuauserv
Remove-Item -Path "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue