PowerShell Genie

PowerShell Sites and Services

Check client subnet mapping and replication topology as separate parts of a site problem.

Lesson 2 min read Windows PowerShell 5.1 and PowerShell 7

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
  1. Stage 1[pscustomobject]@{Positional values or no named parameters
  2. Stage 2Format-ListPositional 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-List

    What 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

    Microsoft Learn: get-adreplicationsubnet

    Try it

    Expected output · prints command text; does not execute these commands

    1PS> [pscustomobject]@{
    2PS> Sites = 'Get-ADReplicationSite -Filter *'
    3PS> Subnets = 'Get-ADReplicationSubnet -Filter * | Select-Object Name, Site'
    4PS> Links = 'Get-ADReplicationSiteLink -Filter * | Select-Object Name, Cost, ReplicationFrequencyInMinutes'
    5PS> Symptom = 'a subnet with no site sends clients to a random DC'
    6PS> } | Format-List

    Example reader

    Inspect this page's example

    Fictional browser data when supported

    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 SPNs

      Check your understanding

      A client selects a remote DC. Which site configuration should you inspect?

      Genie guidePowerShell Sites and Services

      Check client subnet mapping and replication topology as separate parts of a site problem.