18 lines
354 B
PowerShell
18 lines
354 B
PowerShell
|
function Test-Ports($ipAddresses, $port){
|
|||
|
<#
|
|||
|
.SYNOPSIS
|
|||
|
This function calls Test-NetConnection for a list of IPAddresses to test availability on a single port
|
|||
|
#>
|
|||
|
|
|||
|
$successCount = 0
|
|||
|
|
|||
|
foreach ($ipAddress in $ipAddresses){
|
|||
|
$tnc = Test-NetConnection -Port $port -ComputerName $ipAddress
|
|||
|
|
|||
|
if ($tnc){
|
|||
|
$successCount++
|
|||
|
}
|
|||
|
}
|
|||
|
return $successCount
|
|||
|
}
|