-
-
Save bplasmeijer/bbd556dda8370a634bc4396a59e95563 to your computer and use it in GitHub Desktop.
Simple Network Host Scan in PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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