rj07thomas

Meshed IP ping

Oct 21st, 2019
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. <#
  2. Pings a range of destination IP addresses from multiple local IP addresses
  3. Wrote this specifically to check that all iSCSI connections were resilient from host to storage
  4. #>
  5.  
  6. Clear-Host
  7.  
  8. [IPAddress]$destAddress = "1.1.1.1"
  9.  
  10. $localiSCSIAddresses = Get-NetIPAddress | where-Object {$_.IPAddress -like "1.1.1.*"}
  11. $iSCSIAddress = $localiSCSIAddresses.ipAddress
  12.  
  13. $destAddressBytes=$destAddress.GetAddressBytes()
  14.  
  15. Do
  16. {
  17. ForEach($address in $iSCSIAddress)
  18. {
  19. $destAddress = ($destAddressBytes[0].ToString()) + "." + ($destAddressBytes[1].ToString()) + "." + ($destAddressBytes[2].ToString()) + "." + ($destAddressBytes[3].ToString())
  20. [console]::ForegroundColor = "Green"
  21. Write-Host "Now pinging" $destAddress "from" $address
  22. [console]::ForegroundColor = "White"
  23. Ping -S $address $destAddress -n 2
  24. Write-Host
  25. }
  26. $destAddressBytes[3] = $destAddressBytes[3]+1
  27. Start-Sleep 10
  28. Clear-Host
  29. }
  30. While($destAddressBytes[3] -lt "18")
Advertisement
Add Comment
Please, Sign In to add comment