Skip to content

Instantly share code, notes, and snippets.

@adamdriscoll
Created April 10, 2018 18:29
Show Gist options
  • Save adamdriscoll/3cfe51866484e6a4ea88cc51b2864124 to your computer and use it in GitHub Desktop.
Save adamdriscoll/3cfe51866484e6a4ea88cc51b2864124 to your computer and use it in GitHub Desktop.
Out-UDGridView port detection
$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