Saturday, March 5, 2016

Powershell get hostname of entire subnet

clear
$ErrorActionPreference = "SilentlyContinue"
$i=1
while($i -le 255)
{
$ipp=$i.ToString()
$pre="192.168.1." + $ipp
$addr=$pre
[System.Net.Dns]::GetHostbyAddress($addr) |select AddressList, Hostname
$i=$i+1
}

No comments:

Post a Comment

Thanks for showing interest in tech-jockey.

Content of this blog has been moved to GITHUB

Looking at current trends and to make my content more reachable to people, I am moving all the content of my blog https://tech-jockey.blogsp...