PowerShell Sites and Services
Check client subnet mapping and replication topology as separate parts of a site problem.
Documentation: Microsoft Learn
Overview
An AD subnet maps an IP range to a site. A client’s site influences service discovery. Compare the client’s actual IP address with configured subnets, then use nltest /dsgetsite to inspect its site association.
A missing or incorrect mapping can lead to remote DC selection, but discovery also depends on available records, reachable DCs and cached information. Do not assume an unmapped client chooses uniformly at random or that every slow logon is a subnet problem.
Site-link cost expresses relative path preference for intersite topology. Schedule and replication interval determine when a link can be used. Network reachability remains a separate requirement: changing a cost does not open a firewall or repair a WAN path.
Before changing topology, record the intended site, selected DC, replication partners and existing schedules. Compare with the network team’s current subnet inventory instead of copying an address range from an old diagram.
Inspect this example’s structure
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
[pscustomobject]@{
Sites = 'Get-ADReplicationSite -Filter *'
Subnets = 'Get-ADReplicationSubnet -Filter * | Select-Object Name, Site'
Links = 'Get-ADReplicationSiteLink -Filter * | Select-Object Name, Cost, ReplicationFrequencyInMinutes'
Symptom = 'a subnet with no site sends clients to a random DC'
} | Format-List- Stage 1[pscustomobject]@{
Positional values or no named parameters - Stage 2Format-List
Positional values or no named parameters
An example to inspect
Preview the example. Sign in for the full lesson and activities.
[pscustomobject]@{
Sites = 'Get-ADReplicationSite -Filter *'
Subnets = 'Get-ADReplicationSubnet -Filter * | Select-Object Name, Site'
Links = 'Get-ADReplicationSiteLink -Filter * | Select-Object Name, Cost, ReplicationFrequencyInMinutes'
Symptom = 'a subnet with no site sends clients to a random DC'
} | Format-ListWhat happens
These are inventory command strings. In a real investigation, compare their returned mappings with the affected client, then verify DC discovery and partner replication after the change.
Worth remembering
A correct subnet mapping is useful evidence, but verify client discovery and replication behavior as well.
Primary documentation
Try it
Expected output · prints command text; does not execute these commands
Example reader
Inspect this page's example
Run supported commands against the practice data, or inspect the example without executing it.
Ready to inspect.
Prints the site, subnet and site-link inventory queries.
Show reference output
Expected output · prints command text; does not execute these commands
Sites : Get-ADReplicationSite -Filter * Subnets : Get-ADReplicationSubnet -Filter * | Select-Object Name, Site Links : Get-ADReplicationSiteLink -Filter * | Select-Object Name, Cost, ReplicationFrequencyInMinutes Symptom : a subnet with no site sends clients to a random DC
Keep going
Next: PowerShell Kerberos and SPNsCheck your understanding
A client selects a remote DC. Which site configuration should you inspect?
Check whether the client IP matches an AD subnet and whether that subnet belongs to the intended site. Then inspect DC discovery and DNS.