PowerShell Lab Complete!

You've mastered troubleshooting and migration PowerShell commands!

Take the Quiz → Try GUI Lab

Network Troubleshooting

1. Test Basic Connectivity
Ping a remote server to verify network reachability.
Test-Connection -ComputerName DC02 -Count 4
2. Test Port Connectivity
Verify a specific port is open on a remote server (LDAP port 389).
Test-NetConnection -ComputerName DC02 -Port 389
3. Resolve DNS Names
Look up DNS records for a hostname to verify name resolution.
Resolve-DnsName -Name dc02.hexworth.local
4. View Active TCP Connections
List all established TCP connections to identify active network sessions.
Get-NetTCPConnection -State Established

AD & DC Diagnostics

5. Run DC Diagnostics
Execute dcdiag to check Active Directory health on a domain controller.
dcdiag /v
6. Check AD Replication
View AD replication status and identify any replication failures.
repadmin /replsummary
7. Query Error Events
Filter the System event log for error-level events.
Get-WinEvent -FilterHashtable @{LogName='System';Level=2} -MaxEvents 20

System Integrity

8. Check System File Integrity
Run System File Checker to scan and repair protected OS files.
sfc /scannow
9. Check Windows Image Health
Use DISM to check the health of the Windows component store.
DISM /Online /Cleanup-Image /CheckHealth
10. Repair Windows Image
Use DISM to restore health if the component store is corrupted.
DISM /Online /Cleanup-Image /RestoreHealth

Migration & Backup

11. Install Migration Tools
Install the Windows Server Migration Tools feature for role migration.
Install-WindowsFeature Migration -IncludeManagementTools
12. Export Installed Drivers
Export all third-party drivers for migration to a new server.
Export-WindowsDriver -Online -Destination "D:\DriverBackup"
13. Get Windows Features for Migration
List all installed roles and features to document current server configuration.
Get-WindowsFeature | Where-Object Installed | Select-Object Name, InstallState
14. Create a Windows Server Backup
Start a full system state backup for disaster recovery.
wbadmin start systemstatebackup -backupTarget:D:
Diagnostic Commands:
dcdiag - Domain controller health
repadmin - AD replication status
sfc /scannow - System file checker
DISM - Deployment Image Servicing
Test-NetConnection - Port-level network test
Resolve-DnsName - DNS lookups
Tip: Use Get-WinEvent -FilterHashtable @{LogName='System';Level=2} for fast server-side filtering instead of piping through Where-Object. FilterHashtable is significantly faster on large event logs.
Migration Checklist:
1. Document installed roles with Get-WindowsFeature
2. Export drivers with Export-WindowsDriver
3. Backup system state with wbadmin
4. Install Migration Tools on source and target
5. Use Send-SmigServerData / Receive-SmigServerData
DISM Workflow: Always run CheckHealth first (quick check), then ScanHealth (thorough scan), and only if corruption is found, run RestoreHealth (repairs from Windows Update or local source).
Common Port Reference:
53 - DNS
88 - Kerberos
135 - RPC Endpoint Mapper
389 - LDAP
445 - SMB
636 - LDAPS (Secure)
3389 - RDP
Storage Migration Service:
Windows Server 2019+ includes Storage Migration Service for migrating file servers. Use Install-WindowsFeature SMS-Proxy on both source and destination, then orchestrate via Windows Admin Center or PowerShell with New-SmsJob cmdlets.