131 commands · 8 cheat sheets · Windows
Networking and Remote Access master quick reference
Browse 131 commands from 8 focused cheat sheets on page 1 of 1. Each example opens its matching detailed section.
Networking and Remote Access · 19 commands
PowerShell Network Diagnostics Cheat Sheet
| Use | Syntax | Examples |
|---|---|---|
| Show active configuration | Get-NetIPConfiguration | View examples |
| Include disconnected interfaces | Get-NetIPConfiguration -All | View examples |
| List IPv4 addresses | Get-NetIPAddress -AddressFamily IPv4 | View examples |
| Inspect interface state | Get-NetIPInterface | Sort-Object InterfaceMetric | View examples |
| Show IPv4 routes | Get-NetRoute -AddressFamily IPv4 |
Sort-Object RouteMetric | View examples |
| Find the selected route | Find-NetRoute -RemoteIPAddress 1.1.1.1 | View examples |
| Inspect neighbor state | Get-NetNeighbor -AddressFamily IPv4 | View examples |
| Resolve IPv4 records | Resolve-DnsName -Name example.com -Type A | View examples |
| Query a specific DNS server | Resolve-DnsName -Name example.com -Type A -Server `
192.0.2.53 | View examples |
| Clear the client DNS cache | Clear-DnsClientCache -WhatIf | View examples |
| Test ICMP reachability | Test-Connection -TargetName example.com -Count 4 | View examples |
| Test a host | Test-NetConnection -ComputerName example.com | View examples |
| Test a TCP port | Test-NetConnection -ComputerName example.com -Port 443 `
-InformationLevel Detailed | View examples |
| Trace the route | Test-NetConnection -ComputerName example.com -TraceRoute | View examples |
| Show TCP listeners | Get-NetTCPConnection -State Listen |
Sort-Object LocalPort | View examples |
| Show established TCP sessions | Get-NetTCPConnection -State Established | View examples |
| Show UDP endpoints | Get-NetUDPEndpoint | Sort-Object LocalPort | View examples |
| Map a socket to its process | Get-Process -Id (Get-NetTCPConnection -LocalPort `
443).OwningProcess | View examples |
| Capture a port-test object | $test = Test-NetConnection example.com -Port 443 `
-InformationLevel Detailed | View examples |
Networking and Remote Access · 12 commands
PowerShell Remoting Cheat Sheet
| Use | Syntax | Examples |
|---|---|---|
| Test WSMan | Test-WSMan -ComputerName 'server01' | View examples |
| Run one command | Invoke-Command -ComputerName 'server01' -ScriptBlock { `
Get-Date } | View examples |
| Pass arguments | Invoke-Command -ComputerName 'server01' -ScriptBlock { `
param($name) Get-Service -Name $name } -ArgumentList `
'Spooler' | View examples |
| Fan out to hosts | Invoke-Command -ComputerName 'server01','server02' `
-ScriptBlock { hostname } | View examples |
| Create a persistent session | $session = New-PSSession -ComputerName 'server01' | View examples |
| Enter interactively | Enter-PSSession -Session $session | View examples |
| Close a session | Remove-PSSession -Session $session | View examples |
| Prompt for credentials | $credential = Get-Credential | View examples |
| Connect over SSH | New-PSSession -HostName 'server01' -UserName 'deploy' `
-SSHTransport | View examples |
| Copy into a session | Copy-Item -LiteralPath '.\config.json' -Destination `
'C:\Temp\config.json' -ToSession $session | View examples |
| Stop on remote non-terminating errors | Invoke-Command -Session $session -ScriptBlock { Get-Item `
C:\missing -ErrorAction Stop } | View examples |
| List endpoints | Get-PSSessionConfiguration | View examples |
Networking and Remote Access · 13 commands
Windows Defender Firewall PowerShell Cheat Sheet
| Use | Syntax | Examples |
|---|---|---|
| Inspect profiles | Get-NetFirewallProfile |
Select-Object Name, Enabled, DefaultInboundAction, DefaultOutboundAction | View examples |
| List active enabled rules | Get-NetFirewallRule -PolicyStore ActiveStore -Enabled `
True | View examples |
| Get one rule | Get-NetFirewallRule -Name 'CmdMemo-HTTPS-In' | View examples |
| Inspect ports | Get-NetFirewallRule -Name 'CmdMemo-HTTPS-In' |
Get-NetFirewallPortFilter | View examples |
| Inspect addresses | Get-NetFirewallRule -Name 'CmdMemo-HTTPS-In' |
Get-NetFirewallAddressFilter | View examples |
| Inspect program scope | Get-NetFirewallRule -Name 'CmdMemo-HTTPS-In' |
Get-NetFirewallApplicationFilter | View examples |
| Preview an inbound rule | New-NetFirewallRule -Name 'CmdMemo-HTTPS-In' `
-DisplayName 'CmdMemo HTTPS' -Direction Inbound `
-Action Allow -Protocol TCP -LocalPort 443 -Profile `
Domain -WhatIf | View examples |
| Preview disabling | Disable-NetFirewallRule -Name 'CmdMemo-HTTPS-In' -WhatIf | View examples |
| Preview enabling | Enable-NetFirewallRule -Name 'CmdMemo-HTTPS-In' -WhatIf | View examples |
| Preview removal | Remove-NetFirewallRule -Name 'CmdMemo-HTTPS-In' -WhatIf | View examples |
| Export firewall policy | netsh advfirewall export 'C:\Backup\firewall.wfw' | View examples |
| Test a TCP endpoint | Test-NetConnection -ComputerName 'server01' -Port 443 `
-InformationLevel Detailed | View examples |
| Inspect profile logging | Get-NetFirewallProfile |
Select-Object Name, LogAllowed, LogBlocked, LogFileName | View examples |
Networking and Remote Access · 18 commands
Windows DHCP Server PowerShell Administration Cheat Sheet
| Use | Syntax | Examples |
|---|---|---|
| Inspect DHCP role state | Get-WindowsFeature -Name DHCP,RSAT-DHCP |
Select-Object Name, InstallState | View examples |
| Inspect DhcpServer module | Get-Module -ListAvailable -Name DhcpServer |
Select-Object Name, Version, Path | View examples |
| List authorized servers | Get-DhcpServerInDC | View examples |
| Preview authorization | Add-DhcpServerInDC -DnsName 'dhcp01.corp.example' `
-IPAddress '192.0.2.10' -WhatIf | View examples |
| List IPv4 scopes | Get-DhcpServerv4Scope -ComputerName `
'dhcp01.corp.example' | View examples |
| Inspect active leases | Get-DhcpServerv4Lease -ComputerName `
'dhcp01.corp.example' -ScopeId '192.0.2.0' -AllLeases | View examples |
| Read scope statistics | Get-DhcpServerv4ScopeStatistics -ComputerName `
'dhcp01.corp.example' -ScopeId '192.0.2.0' | View examples |
| Preview an inactive scope | Add-DhcpServerv4Scope -ComputerName 'dhcp01' -Name `
'VLAN-120' -StartRange 192.0.2.50 -EndRange `
192.0.2.199 -SubnetMask 255.255.255.0 -State InActive `
-WhatIf | View examples |
| Preview an exclusion | Add-DhcpServerv4ExclusionRange -ComputerName 'dhcp01' `
-ScopeId '192.0.2.0' -StartRange '192.0.2.1' -EndRange `
'192.0.2.49' -WhatIf | View examples |
| Inspect effective options | Get-DhcpServerv4OptionValue -ComputerName `
'dhcp01.corp.example' -ScopeId '192.0.2.0' -All | View examples |
| Preview common options | Set-DhcpServerv4OptionValue -ComputerName 'dhcp01' `
-ScopeId '192.0.2.0' -Router '192.0.2.1' -DnsServer `
'192.0.2.20','192.0.2.21' -WhatIf | View examples |
| Preview a reservation | Add-DhcpServerv4Reservation -ComputerName 'dhcp01' `
-ScopeId '192.0.2.0' -IPAddress '192.0.2.80' -ClientId `
'00-11-22-33-44-55' -WhatIf | View examples |
| Inspect DNS update policy | Get-DhcpServerv4DnsSetting -ComputerName `
'dhcp01.corp.example' -ScopeId '192.0.2.0' | View examples |
| Inspect failover | Get-DhcpServerv4Failover -ComputerName `
'dhcp01.corp.example' -ScopeId '192.0.2.0' | View examples |
| Preview load-balance failover | Add-DhcpServerv4Failover -ComputerName 'dhcp01' -Name `
'SITE-A' -PartnerServer 'dhcp02' -ScopeId 192.0.2.0 `
-SharedSecret '<approved-secret>' -WhatIf | View examples |
| Preview failover replication | Invoke-DhcpServerv4FailoverReplication -ComputerName `
'dhcp01.corp.example' -Name 'SITE-A' -WhatIf | View examples |
| Preview DHCP export | Export-DhcpServer -ComputerName 'dhcp01.corp.example' `
-File 'C:\DHCP-Backup\dhcp01.xml' -Leases -WhatIf | View examples |
| Read DHCP admin events | Get-WinEvent -LogName `
'Microsoft-Windows-DHCP Server Events/Admin' `
-MaxEvents 100 | View examples |
Networking and Remote Access · 18 commands
Windows DNS Server PowerShell Administration Cheat Sheet
| Use | Syntax | Examples |
|---|---|---|
| Inspect DNS role state | Get-WindowsFeature -Name DNS,RSAT-DNS-Server |
Select-Object Name, InstallState | View examples |
| Inspect DnsServer module | Get-Module -ListAvailable -Name DnsServer |
Select-Object Name, Version, Path | View examples |
| List hosted zones | Get-DnsServerZone -ComputerName 'dns01.corp.example' | View examples |
| Inspect one zone | Get-DnsServerZone -ComputerName 'dns01.corp.example' -Name 'corp.example' |
Format-List * | View examples |
| Read an A record | Get-DnsServerResourceRecord -ComputerName `
'dns01.corp.example' -ZoneName 'corp.example' -Name `
'app01' -RRType A | View examples |
| Query a chosen server | Resolve-DnsName -Name 'app01.corp.example' -Type A `
-Server 'dns01.corp.example' -DnsOnly | View examples |
| Preview an AD zone | Add-DnsServerPrimaryZone -ComputerName 'dns01' -Name `
'apps.corp.example' -ReplicationScope Domain `
-DynamicUpdate Secure -WhatIf | View examples |
| Preview a reverse zone | Add-DnsServerPrimaryZone -ComputerName 'dns01' `
-NetworkId '192.0.2.0/24' -ReplicationScope Domain `
-DynamicUpdate Secure -WhatIf | View examples |
| Preview A and PTR records | Add-DnsServerResourceRecordA -ComputerName 'dns01' `
-ZoneName 'corp.example' -Name 'app01' -IPv4Address `
'192.0.2.40' -CreatePtr -WhatIf | View examples |
| Preview a CNAME | Add-DnsServerResourceRecordCName -ComputerName 'dns01' `
-ZoneName 'corp.example' -Name 'portal' -HostNameAlias `
'app01.corp.example' -WhatIf | View examples |
| Preview exact record removal | Remove-DnsServerResourceRecord -ComputerName 'dns01' `
-ZoneName 'corp.example' -RRType A -Name 'app01' `
-RecordData '192.0.2.40' -WhatIf | View examples |
| Inspect zone aging | Get-DnsServerZoneAging -ComputerName `
'dns01.corp.example' -Name 'corp.example' | View examples |
| Preview aging settings | Set-DnsServerZoneAging -ComputerName 'dns01' -Name `
'corp.example' -Aging $true -NoRefreshInterval `
7.00:00:00 -RefreshInterval 7.00:00:00 -WhatIf | View examples |
| Inspect forwarders | Get-DnsServerForwarder -ComputerName `
'dns01.corp.example' | View examples |
| Inspect recursion policy | Get-DnsServerRecursion -ComputerName `
'dns01.corp.example' | View examples |
| Preview zone export | Export-DnsServerZone -ComputerName 'dns01.corp.example' `
-Name 'corp.example' -FileName `
'corp-example-audit.txt' -WhatIf | View examples |
| Inspect DNSSEC settings | Get-DnsServerDnsSecZoneSetting -ComputerName `
'dns01.corp.example' -ZoneName 'corp.example' | View examples |
| Read recent DNS events | Get-WinEvent -FilterHashtable @{LogName='DNS Server'; `
StartTime=(Get-Date).AddHours(-2)} -MaxEvents 100 | View examples |
Networking and Remote Access · 16 commands
Windows Network Load Balancing Cheat Sheet
| Use | Syntax | Examples |
|---|---|---|
| Inspect NLB feature | Get-WindowsFeature NLB,RSAT-NLB | View examples |
| Inspect network adapters | Get-NetAdapter |
Select-Object Name,InterfaceDescription,Status,MacAddress,LinkSpeed | View examples |
| List NLB clusters | Get-NlbCluster | View examples |
| List cluster nodes | Get-NlbClusterNode -HostName NLB01 | View examples |
| List port rules | Get-NlbClusterPortRule -HostName NLB01 | View examples |
| Create cluster | New-NlbCluster -InterfaceName 'Ethernet' `
-ClusterPrimaryIP 192.0.2.20 -ClusterName `
web.contoso.example -OperationMode Multicast | View examples |
| Add node | Add-NlbClusterNode -NewNodeName NLB02 -NewNodeInterface `
'Ethernet' -InterfaceName 'Ethernet' -HostName NLB01 | View examples |
| Add balanced HTTPS rule | Add-NlbClusterPortRule -InterfaceName 'Ethernet' `
-StartPort 443 -EndPort 443 -Protocol TCP -Affinity `
Single | View examples |
| Set node load weight | Get-NlbClusterPortRule -HostName NLB01 -StartPort 443 |
Set-NlbClusterPortRuleNodeWeight -LoadWeight 50 | View examples |
| Drain node traffic | Stop-NlbClusterNode -HostName NLB01 -Drain | View examples |
| Resume node traffic | Start-NlbClusterNode -HostName NLB01 | View examples |
| Suspend NLB control | Suspend-NlbClusterNode -HostName NLB01 | View examples |
| Read node operational state | Get-NlbClusterNode -HostName NLB01 |
Select-Object HostName,State,Status,Priority | View examples |
| Test application endpoint | Test-NetConnection web.contoso.example -Port 443 | View examples |
| Read NLB events | Get-WinEvent -ProviderName Microsoft-Windows-NLB `
-MaxEvents 100 | View examples |
| Remove a drained node | Remove-NlbClusterNode -HostName NLB02 | View examples |
Networking and Remote Access · 18 commands
Windows Remote Desktop Services and Sessions PowerShell Cheat Sheet
| Use | Syntax | Examples |
|---|---|---|
| Check RDS cmdlets | Get-Module -ListAvailable 'RemoteDesktop' |
Select-Object Name, Version, Path | View examples |
| List deployment servers | Get-RDServer -ConnectionBroker 'rdcb01.contoso.com' |
Sort-Object Server | View examples |
| List session hosts | Get-RDServer -ConnectionBroker 'rdcb01.contoso.com' `
-Role 'RDS-RD-SERVER' | View examples |
| List session collections | Get-RDSessionCollection -ConnectionBroker 'rdcb01.contoso.com' |
Sort-Object CollectionName | View examples |
| List collection hosts | Get-RDSessionHost -CollectionName 'Finance Apps' `
-ConnectionBroker 'rdcb01.contoso.com' | View examples |
| Inspect connection policy | Get-RDSessionCollectionConfiguration -CollectionName `
'Finance Apps' -Connection -ConnectionBroker `
'rdcb01.contoso.com' | View examples |
| Inspect security policy | Get-RDSessionCollectionConfiguration -CollectionName `
'Finance Apps' -Security -ConnectionBroker `
'rdcb01.contoso.com' | View examples |
| Inspect authorized groups | Get-RDSessionCollectionConfiguration -CollectionName `
'Finance Apps' -UserGroup -ConnectionBroker `
'rdcb01.contoso.com' | View examples |
| List published RemoteApps | Get-RDRemoteApp -CollectionName 'Finance Apps' `
-ConnectionBroker 'rdcb01.contoso.com' | View examples |
| Inspect RDS licensing | Get-RDLicenseConfiguration -ConnectionBroker `
'rdcb01.contoso.com' | View examples |
| List deployment sessions | Get-RDUserSession -ConnectionBroker 'rdcb01.contoso.com' |
Sort-Object HostServer, UnifiedSessionId | View examples |
| List collection sessions | Get-RDUserSession -CollectionName 'Finance Apps' `
-ConnectionBroker 'rdcb01.contoso.com' | View examples |
| Resolve one user's sessions | Get-RDUserSession -ConnectionBroker 'rdcb01.contoso.com' |
Where-Object { $_.DomainName -eq 'CONTOSO' -and $_.UserName -eq 'alice' } | View examples |
| Query host-local sessions | quser.exe /server:rdsh01.contoso.com | View examples |
| Notify one session | Send-RDUserMessage -HostServer 'rdsh01.contoso.com' `
-UnifiedSessionID 12 -MessageTitle 'Maintenance' `
-MessageBody 'Save work by 22:00 UTC.' | View examples |
| Disconnect one session | Disconnect-RDUser -HostServer 'rdsh01.contoso.com' `
-UnifiedSessionID 12 | View examples |
| Log off one session | Invoke-RDUserLogoff -HostServer 'rdsh01.contoso.com' `
-UnifiedSessionID 12 | View examples |
| Read Session Host events | Get-WinEvent -LogName `
'Microsoft-Windows-TerminalServices-LocalSessionManager/Operational' `
-MaxEvents 100 | View examples |



