You can try "$($var)"

You can debug and write out the contents to standard out or to a file
before running the command

On Wed, Sep 28, 2016, 2:48 PM Sean Martin <[email protected]> wrote:

> 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"$
> $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