Skip to content

Instantly share code, notes, and snippets.

@bplasmeijer
Forked from poshcodebear/simple-network-scan.ps1
Last active July 25, 2022 20:10
Show Gist options
  • Save bplasmeijer/bbd556dda8370a634bc4396a59e95563 to your computer and use it in GitHub Desktop.
Save bplasmeijer/bbd556dda8370a634bc4396a59e95563 to your computer and use it in GitHub Desktop.
Simple Network Host Scan in PowerShell
$subnet = '10.224.0'
(1..254) | foreach {
$ip = "$subnet.$_"
$props = @{
'IP' = $ip ;
'Name' = (Resolve-DnsName $ip -ErrorAction SilentlyContinue | select -ExpandProperty NameHost) ;
'Response' = (Test-Connection $ip -Quiet -Count 1)
}
$obj = New-Object -TypeName psobject -Property $props
Write-Output $obj
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment