Skip to content

Instantly share code, notes, and snippets.

@Hugoberry
Last active March 21, 2017 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hugoberry/ff92f9f9d0c39c75eae60ee7b7f083d1 to your computer and use it in GitHub Desktop.
Save Hugoberry/ff92f9f9d0c39c75eae60ee7b7f083d1 to your computer and use it in GitHub Desktop.
Power Query finding port number of the running embeded tabular instance
()=>
let
//Assume current user is the one with latest [Date accessed] folder in C:\Users
CurrentUser = Table.FirstN(
Table.Sort(Folder.Contents("C:\Users"),
{{"Date accessed", Order.Descending}}),
1)[Name]{0},
//Read the contents of file msmdsrv.port.txt from subfolder of AnalysisServicesWorkspaces
Port = Lines.FromBinary(
Table.SelectRows(
Folder.Files("C:\Users\"&
CurrentUser&
"\AppData\Local\Microsoft\Power BI Desktop\AnalysisServicesWorkspaces"),
each ([Name] = "msmdsrv.port.txt"))[Content]{0},null,null,1200){0}
in
Port
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment