Code:
$Computers = Import-Csv -Path C:\temp\Computers.csv
write-host $Computers
CSV file (where US-1 is A1, US-2 is A2, and so on)
US-1
US-2
US-3
US-4
I believe Import-Csv is importing incorrectly because Write-Host $Computers gives me this:
@{US-1=US-2} @{US-1=US-3} @{US-1=US-4}
But if $Computers is assigned this way:
$Computers = "US-1", "US-2", "US-3", "US-4"
The output is correct:
US-1 US-2 US-3 US-4
So, I would need to import from a CSV for convenience but having each computer name saved the right way, without brackets or symbols. This makes using the computers names in the rest of my program very difficult.
EDIT: as discussed, I have correctly formatted the csv, which is now this:
Computers,
US-1
US-2
US-3
US-4
Now getting output:
@{Computers=US-1} @{Computers=US-2} @{Computers=US-3} @{Computers=US-4}
