Created
September 16, 2019 02:26
-
-
Save guyinacube/af42d725bc329d54f2c2480a61e8bf98 to your computer and use it in GitHub Desktop.
Get the Power BI Diagnostic port using PowerShell
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
#PLEASE OPEN YOUR POWER BI DESKTOP FILE BEFORE RUNNING THIS SCRIPT!!!!! | |
#Gets a list of teh ProcessIDs for all Open Power BI Desktop files | |
$processids = Get-Process msmdsrv | Select-Object -ExpandProperty id | |
#Loops through each ProcessIDs, gets the diagnostic port for each file, and finally generates the connection that can be use when connecting to the Vertipaq model. | |
if($processids) | |
{ | |
foreach($processid in $processids) | |
{ | |
$pbidiagnosticport = Get-NetTCPConnection | ? {($_.State -eq "Listen") -and ($_.RemoteAddress -eq "0.0.0.0") -and ($_.OwningProcess -eq $processid)} | Select-Object -ExpandProperty LocalPort | |
Write-Host "Enter this into the tool of your choice -- localhost:$pbidiagnosticport" -ForegroundColor Green | |
} | |
} | |
else | |
{ | |
Write-Host "Please open a Power BI File!" -ForegroundColor Red | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment