Little help please,
I am writing a script to look at a csv file and if a certain value exists then do something, but in doing something the script would need to pull the information from that same column. Below is an example bit of code, from this i want the script to look at that csv file and if it finds a value of test3 to return the value in the IPAddr column of the same row...
"Name","Hostname","IPAddr"
"test1","testing1","1.1.1.1"
"test2","testing2","2.2.2.2"
"test3","testing3","3.3.3.3"
$testcsv = import-csv "C:\Rich\Test.csv"
$hostname = "test3"
$Output = @()
where-object ($hostname -eq $testcsv.Name) {
$output += $testcsv.name
$output += $testcsv.IPAddr
}
$Output | out-file "C:\Rich\testoutput.txt"