Created
April 10, 2018 18:29
-
-
Save adamdriscoll/3cfe51866484e6a4ea88cc51b2864124 to your computer and use it in GitHub Desktop.
Out-UDGridView port detection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Ports = Get-CimInstance -ClassName MSFT_NetTCPConnection -Namespace root\StandardCimv2 | Where-Object State -eq 'Listen' | |
$Port = 10000 | |
foreach($Port in 10000..20000) { | |
if (($Ports.LocalPort | Where-Object { $_ -eq $Port } | Measure-Object).Count -eq 0) | |
{ | |
break | |
} | |
} | |
Start-UDDashboard -Dashboard $Dashboard -Port $Port -Name "OutUDGridView" | |
Start-Process http://localhost:$Port |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment