PowerShell/docs/scan-network.md

36 lines
922 B
Markdown
Raw Permalink Normal View History

2024-11-08 12:38:20 +01:00
The *scan-network.ps1* Script
===========================
2024-05-19 10:25:56 +02:00
scan-network.ps1
Parameters
----------
```powershell
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
```
Script Content
--------------
```powershell
$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
```
2024-11-20 11:52:20 +01:00
*(generated by convert-ps2md.ps1 as of 11/20/2024 11:52:00)*