Wednesday 20 April 2022

powershell script to ping multiple ip addresses

Taken fromhttps://social.technet.microsoft.com/wiki/contents/articles/52396.powershell-ping-list-of-ip-addresses.aspx 

Note that we're using System.Net.NetworkInformation.Ping in these examples. However, you could also use the Test-Connection Jump PowerShell cmdlet or some other command maybe

script----------------------------------

Start-Transcript -Path .\log.txt

(Get-Content .\IPAddresses.txt) | ForEach {Write-Host $_, "-", ([System.Net.NetworkInformation.Ping]::new().Send($_)).Status}

Stop-Transcript

script----------------------------------


input file--------------------------------

1.1.1.1

8.8.8.8

8.8.4.4

input file--------------------------------

No comments:

Post a Comment