Lothar
Lothar

Reputation: 37

New-ADReplicationSubnet : The object name has bad syntax

I don't understand why this simple PowerShell script below fails:

Import-Csv "C:\Users\me\Desktop\files\sitesTest.csv" | ForEach-Object { 

     New-ADReplicationSubnet -Name $_.Name -Site $_.Site -Location $_.Location }

but the worst comes when I simply run a

New-ADReplicationSubnet -Name "10.66.208.129/27" -Site MYSITE

and I get the same error message!! Which is:

New-ADReplicationSubnet : The object name has bad syntax
At line:1 char:1
+ New-ADReplicationSubnet -Name "10.66.208.129/27" -Site MYSITE
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (CN=10.66.208.12...l,DC=mine,DC=org:String) [New-ADReplicationSubnet], ADException
    + FullyQualifiedErrorId : ActiveDirectoryServer:8335,Microsoft.ActiveDirectory.Management.Commands.NewADReplicationSubnet

Upvotes: 0

Views: 663

Answers (1)

Mathias R. Jessen
Mathias R. Jessen

Reputation: 174505

I suspect the DSA expects the subnet name to come in the format: <first IP in Block>/<prefix>, so try:

New-ADReplicationSubnet -Name "10.66.208.128/27" -Site MYSITE

Upvotes: 1

Related Questions