Skip to content

Instantly share code, notes, and snippets.

@otuva
Created April 10, 2024 08:12
Show Gist options
  • Save otuva/1f5f58d0ed47c2c94692db8912cbfebc to your computer and use it in GitHub Desktop.
Save otuva/1f5f58d0ed47c2c94692db8912cbfebc to your computer and use it in GitHub Desktop.
host discovery ip - hostname
1..254 | ForEach-Object {
$ip = "192.168.24.$_"
try {
$currenthost = [System.Net.DNS]::GetHostEntry( $ip ).Hostname.ToUpper()
"$ip - $currenthost"
} catch {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment