mardi 11 août 2020

Foreach / If with a CSV File

I would like to setup a script to run automatically which would read a through a CSV file and notify us if WAN1 Status is failed etc.

Please see basic script below:

"$merakicsv = Import-Csv 'C:\Python\Scripts\2020-08-11.csv'

$merakiselectedcsv = $merakicsv | select "Network", "WAN1 Status", "WAN2 Status"

Output of $merakiselectedcsv

Network WAN1 Status WAN2 Status


NETWORK1 Failed Not connected

NETWORK2 Active Not connected

NETWORK3 Active Ready"

I cant quite figure out how to write the foreach to read through the CSV and I would really like some assistance / advice.

Assistance is greatly appreciated.

Aucun commentaire:

Enregistrer un commentaire