What is $Location.GetType().fullname ?? I’d guess it isn’t a system.string and 
it needs to be.

From: [email protected] [mailto:[email protected]] On 
Behalf Of Sean Martin
Sent: Wednesday, September 28, 2016 5:41 PM
To: [email protected]
Subject: [NTSysADM] Adding Subnets to Sites and Services via PowerShell

I have a nagging issue with a script I recently put together to add a few 
hundred subnets to ADSS. The script simply imports a csv with four headers: 
Subnet, Description, Location, Site; builds the variables and then runs the 
following command:

New-ADReplicationSubnet -Name $Subnet -Site $Site -Description $Description 
-Location $Location -PassThru

When I run the script, the subnet is created successfully but the location 
field is blank. Our location fields are in the format: St/City/Location

However, within powershell, if I manually populate the variables and run the 
same command, the location is added successfully.

$Subnet = "1.1.1.0/24<http://1.1.1.0/24>"$
$Description = "Test Subnet"
$Site = "SiteName"
$Location = "AK/Anchorage/Test Subnet"

New-ADReplicationSubnet -Name $Subnet -Site $Site -Description $Description 
-Location $Location -PassThru

Is the data handled differently when importing from CSV? Do I need to include 
escape characters? I admittedly haven't done a ton of research yet, hoping this 
was an easy one that someone can assist with.

Reply via email to