I want to add a column and a value to an existing array generated from a CSV.
This is my code:
$mycsv = "C:\Users\test\Documents\serveurs.csv"
$servers = Import-Csv $mycsv
This is the result:
ServerName Ip ---------- -- Castor 172.22.0.64 Pollux 172.22.0.67
I want to add new column with value for each ServerName, like this:
ServerName Ip Available ---------- -- --------- Castor 172.22.0.64 Yes Pollux 172.22.0.67 No
I tried the code below:
$item = New-Object PSObject
$item | Add-Member -Type NoteProperty -Name 'Available' -Value 'Yes'
$servers += $item
But it's actually not working, can anyone help me?
The final idea is to have value assigned if the server is reachable or not over the network, using Test-Connection cmdlet.