Move Subnet from one AD site to another

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

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!

 

[quote quote=216747][/quote]
Thanks, Didnt knew this could be soo simple :slight_smile: