Wednesday, May 13, 2020

PS | Ping an entire subnet

Hello Guys,

Just wanted to update my notes with this small script but with big use. You can initiate and save entire output in a file with the help of below lines-

#start here
$subnet = "172.26.193"   #Just mention first three octet of any subnet
$start = 1
$end = 254  #Modify the end IP as per your requirement
$ping = 1
$OutPath ="C:\Temp\172.26.193"    #Modify the file location as per your wish and then run into guys!

While ($start -le $end) {
$IP = "$subnet.$start"
$Test = Test-Connection -ComputerName $IP -count $ping -Quiet
Write-Host "$IP,$Test"
Add-Content -LiteralPath $OutPath -Value "$IP,$Test"
$start++
}
#End here



Thank you,
vCloudNotes

0 comments:

Post a Comment

Sponsor

AD BANNER
Powered by Blogger.
The Magazine

Text Widget

Facebook

Extra Ads

AD BANNER

Welcome to my Notes!

Hello Folks, My name is Gautam Johar. Actively working on VMware Cloud and keen to learn new and latest cloud technologies in market. Love ...

Contact Form

Name

Email *

Message *

Followers



Labels

Translate

Breaking

Random Posts

Follow Us

On Linkedin

Recent Posts

Recent Comments

Header Ads

Popular Posts

Popular Posts

Recent Posts

Text Widget

Search This Blog

Copyright © test blog | Powered by Blogger
Design by Saeed Salam | Blogger Theme by NewBloggerThemes.com