Fiddling with CSV files.

Script wont actually be used since its a silly script but I want to learn a bit more about manipulating a CSV file in Powershell.

Lets say I want to ping every computer in our domain and if the computer is not listed in the CSV, add it to the CSV.

$PingReport = "c:pingreport.csv" foreach($computer in (Get-ADComputer -Filter * -SearchBase "OU=Computers,DC=Company,DC=local" | select -ExpandProperty Name | Sort-Object)){ if(Test-Connection $computer -Count 1) { #If value $computer does exists in column Computer in $pingreport, update column timestamp with (Get-Date). If it does not exist, add $Computer to column Computer in $pingreport 

How would I go about doing the line above?

Later I’ll have to match it with computers and users so the script checks computerc$users and adds it to a different script and measures their user profile size.

submitted by /u/xStimorolx
[link] [comments]

Leave a Reply