Windows Server
More in this section:
- Server Core Initial Setup
- Active Directory: health checks, replication, lockout sources
- Hyper-V
- Exchange Server
System info
powershell
Get-ComputerInfo -Property OsName, OsVersion, CsName, CsDomain
(Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime # uptime
Get-WindowsFeature | Where-Object Installed # installed roles and features
Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 10Connectivity
powershell
Test-NetConnection server01 -Port 443 # is the port reachable?
Get-NetTCPConnection -State Listen | Sort-Object LocalPort # what is listening here
Resolve-DnsName server01.corp.example.com
ipconfig /flushdnsEvent logs
powershell
Get-WinEvent -LogName System -MaxEvents 200 | Where-Object LevelDisplayName -eq 'Error'
Get-WinEvent -FilterHashtable @{LogName='System'; Id=41,6008} -MaxEvents 10 # unexpected shutdownsRepair Windows files
Run DISM first so SFC has good files to repair from:
powershell
DISM /Online /Cleanup-Image /RestoreHealth
sfc /scannowLicensing
powershell
slmgr /dlv # edition, activation status, channel
DISM /Online /Get-CurrentEdition
DISM /Online /Get-TargetEditions # what it can be converted to
# Evaluation to full version (reboots; not supported on a domain controller)
DISM /Online /Set-Edition:ServerStandard /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEulaPrefer IPv4 over IPv6
Keeps IPv6 enabled (Microsoft does not support turning it off) but makes Windows try IPv4 first.
powershell
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters" `
-Name DisabledComponents -PropertyType DWord -Value 0x20 -Force
Restart-Computer| Setting | Value |
|---|---|
| Location | HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters |
| Name | DisabledComponents |
| Type | REG_DWORD |
| Value | 0x20 |
To undo, delete the DisabledComponents value and reboot. Avoid 0xFF (fully disabled); it breaks some Windows components.