top of page

PowerShell - Discover Entire Subnet (Read-Host)

  • Writer: Jon Boyette
    Jon Boyette
  • Jan 13, 2022
  • 1 min read

Save as a subnetinfo.ps1 or self named, This will step through every subnet through 255 and if there is a DNS entry will resolve to hostname.

$A = Read-Host "Enter Subnet to walk through 255 range (ex 10.10.202.) resolving live IP to hostname"

$net = "$A"

0..255 | foreach {$r=(Resolve-DNSname -ErrorAction SilentlyContinue $net$_ | ft NameHost -HideTableHeaders | Out-String).trim().replace("\s+","").replace("`r","").replace("`n"," "); Write-Output "$net$_ $r"} | tee c:\temp\ip_hostname.txt



 
 
 

Recent Posts

See All
PowerShell - List All Domain SPNs

Save as same List_ALL_SPNs.ps1 or similar, this LDap calls the Domain for all Service Principal names and accounts related #Build LDAP...

 
 
 
PowerShell - Start-Monitoring

This is a great script used to Monitor and Email if a server is up or down, once ran, and smtp and from address is set, then run:...

 
 
 

Comments


Post: Blog2 Post
  • Facebook
  • Twitter
  • LinkedIn

©2022 by Boyette Technical Services. Proudly created with Wix.com

bottom of page