Azure VM 관리자에게 필요한 50가지 Windows 명령어 (PowerShell + Active Directory)

발행: (2025년 12월 13일 오전 03:47 GMT+9)
2 min read
원문: Dev.to

Source: Dev.to

왜 이 목록이 존재하는가

Azure 포털은 편리하지만 다음과 같은 상황에서는 한계가 있습니다:

  • RDP가 느릴 때
  • 네트워킹 문제를 해결해야 할 때
  • Active Directory가 깨졌을 때
  • 수십 대의 VM을 트러블슈팅해야 할 때

이때 실제 Windows 명령어가 필요합니다.

네트워킹

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

디스크 관리

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

서비스 관리

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

성능 및 모니터링

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 업데이트

Get-WindowsUpdate
Install-WindowsUpdate -AcceptAll -AutoReboot
Get-WmiObject -Class Win32_QuickFixEngineering | Select HotFixID, InstalledOn

로컬 사용자 및 그룹

Get-LocalGroupMember -Group "Administrators"
Add-LocalGroupMember -Group "Administrators" -Member "CONTOSO\john.doe"
query user
logoff 2 /server:localhost

파일 권한

Get-Acl C:\Important\File.txt | Format-List

방화벽

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

이벤트 로그

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‑특화 명령어

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"

시스템 정보

Get-ComputerInfo | Select WindowsProductName, WindowsVersion, OsBuildNumber
Get-WmiObject -Class Win32_Product | Select Name, Version
Get-WindowsDriver -Online

정리 및 유지보수

net stop wuauserv
del C:\Windows\SoftwareDistribution\*.* /s /q
net start wuauserv
Remove-Item -Path "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
Back to Blog

관련 글

더 보기 »