Sha256: b49f7e997a621632720301d2f5cd0dd799d16c4548a435d9e4f4da0e8075d8c4
Contents?: true
Size: 514 Bytes
Versions: 281
Compression:
Stored size: 514 Bytes
Contents
function IsPortListening { param($portNumber, $protocol) $netstatOutput = netstat -an | Out-String $networkIPs = (Get-WmiObject Win32_NetworkAdapterConfiguration | ? {$_.IPEnabled}) | %{ $_.IPAddress[0] } [array] $networkIPs += "0.0.0.0" foreach ($ipaddress in $networkIPs) { $matchExpression = ("$ipaddress" + ":" + $portNumber) if ($protocol) { $matchExpression = ($protocol.toUpper() + "\s+$matchExpression") } if ($netstatOutput -match $matchExpression) { return $true } } $false }
Version data entries
281 entries across 281 versions & 2 rubygems