Monday, August 20, 2018

Powershell - ping the top of a list

This is a bit of a dodgy, basically the migration was many computers at once each day, feed in from a list. This just picked the top computer and would ping it on screen so I could see if the process had started for the whole group. The first step in my migration was a pre-reboot.



$computers = Import-Csv C:\temp\computerlist.txt
ipconfig /flushdns
#cls

foreach ($computers in $computers){
$ThisComputer=$computers.computername.trim()
$NoMigComputer=$ThisComputer + ".old.gov.au"
ping -t $NoMigComputer -4
}



No comments:

Blog Archive