Move Subnet from one AD site to another

Welcome Forums General PowerShell Q&A Move Subnet from one AD site to another

Viewing 2 reply threads
  • Author
    Posts
    • #216717
      Participant
      Topics: 12
      Replies: 21
      Points: 135
      Rank: Participant

      Can we move Subnet from one Site to another in “ADSites and Subnet”, using the powershell script. I know for creation we use New-ADReplicationSubnet and for deletion remove-ADReplicationSubnet. So will that be 2 script, one for deletion and one for creation for moving the subnets.

      Can we club this as one, instead of going through removal and then addition. I have large number of Subnets that I need to move to the correct AD site

    • #216747
      Participant
      Topics: 3
      Replies: 324
      Points: 1,056
      Helping Hand
      Rank: Community Hero

      This should do what you are asking.

      $SubnetToMove = Get-ADReplicationSubnet -Filter "name -like '192.168.0.0/23'"
      $TargetSite = Get-ADReplicationSite -Filter "name -like 'default*'"
      Set-ADReplicationSubnet -Identity $SubnetToMove -Site $TargetSite
      
      

      Please note, Set-ADReplicationSubnet was not introduced until Server 2012/PS 4.0

      I hope this helps!

       

    • #217512
      Participant
      Topics: 12
      Replies: 21
      Points: 135
      Rank: Participant

      Thanks, Didnt knew this could be soo simple 🙂

Viewing 2 reply threads
  • You must be logged in to reply to this topic.