mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-19 08:28:19 +02:00
Add scan-network.ps1
This commit is contained in:
parent
00d11f8866
commit
5aa9ba219a
13
scripts/scan-network.ps1
Normal file
13
scripts/scan-network.ps1
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
$a = Get-NetIPAddress | Where-Object -FilterScript { $_.SuffixOrigin -eq "DHCP" -or $_.SuffixOrigin -eq "manual" } # | Format-Table -property IPAddress -autoSize
|
||||||
|
|
||||||
|
$arguments = "-sT -T3" # Set sane defaults for command string
|
||||||
|
$location = "nmap" # In case nmap is not in PATH
|
||||||
|
$targets = ""
|
||||||
|
|
||||||
|
foreach ( $i in $a ) {
|
||||||
|
$s = $i.IPAddress + "/" + $i.PrefixLength
|
||||||
|
$targets = $targets + " " + $s
|
||||||
|
}
|
||||||
|
$arguments = $arguments + " " + $targets
|
||||||
|
|
||||||
|
Start-Process $location -ArgumentList $arguments -Wait
|
Loading…
Reference in New Issue
Block a user