Created
July 31, 2015 05:45
-
-
Save poshcodebear/64b647b08d4e55e12258 to your computer and use it in GitHub Desktop.
Simple Network Host Scan in PowerShell
This file contains 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 = '192.168.1' | |
(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