简体   繁体   中英

Powershell - Local Network scan (no domain)

Just wondering if anybody knows a way in powershell to scan the local network for Computers, resolving their name's and IP's.

I know a possibility with Get-ADComputer, but this network is not in a domain.

You can use the .net DNS class in powershell.

reference: http://msdn.microsoft.com/en-us/library/system.net.dns%28v=vs.110%29.aspx

example:

PS C:\> $dns = [system.net.dns]
PS C:\> $dns::GetHostEntry("198.252.206.16") | format-list

HostName    : stackoverflow.com
Aliases     : {}
AddressList : {198.252.206.16}

Scanning example if your network as a 192.168.1.0/24:

$results = @() ; 1..255 | % { $results += $dns::GetHostByAddress("192.168.1.$_") }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM