Application of the Week – Microsoft Power BI Desktop (Part 2)

Application of the week > Application of the Week – Microsoft Power BI Desktop (Part 2)

Shameless plug alert ! Have you seen this event yet? Apologies, that party is over now 😉 Liquit is now 5 years old! My journey with Liquit started more than two years ago and a fantastic ride it has been since. But that’s worth another blog 🙂

Writing this weeks Application of the Week blog I went back to and read the very first blog in this series, written in September of last year. That one was about Microsoft Power BI Desktop.

John Vintzel recently told me something I didn’t know about Power BI Desktop. It’s now being offered as an MSIX package so we don’t have to look at MSIX Readiness anymore. The Microsoft Power BI team has updated the documentation accordingly. Let’s have a look:

So the ‘single executable‘ is still a WiX bootstrapper. That hasn’t changed:

Image

But the interesting change here is this remark:

“You can get the most recent version of Power BI Desktop from the Windows Store”.

Cool! Power BI Desktop is now available in the Microsoft Store (not the Windows Store). It is the exact same application as installed by the MSI:

… but then packaged and offered as an MSIX package:

To deploy ‘Power BI Desktop’ you’re now able to choose between an MSI and MSIX based installation. The application within these packages is identical. The MSIX package automatically disables ‘Update Notifications’. Because updates for MSIX packages from within the application are not permitted. Updates should be deployed either a modification package or by installing a newer version of the MSIX package.

This is the same option which the MSI uses when using the DISABLE_UPDATE_NOTIFICATION property. But to use that you need the MSI and not the single executable (……….) Pause (……….) OK ….. I stop 🙂

They are two ways to use Power BI as explained in detail in this blog of Kasper Langmann. You can opt for online, also called “Power BI Service”, and desktop.

Knowing this, we can design a Smart Icon for ‘Power BI Desktop’ like this:

This Smart Icon contains three actions in one Launch action set for which ‘Stop at first effective action’ is set:

  • the first action runs the PIDesktop.exe executable. This executable is installed when using the x86 or x64 MSI out of a managed package as described in Part 1
  • the second action launches the MicrosoftPowerBIDesktop modern application, but only if that’s installed.
  • the third action uses your default browser to launch the Power BI online url https://app.powerbi.com/?noSignUpCheck=1
    in case Power BI Desktop (MSI or MSIX) is not installed (yet).

In my blogs about Netflix, Deezer and Microsoft Calculator I’ve discussed how to launch applications installed using Appx or MSIX packages using ${SystemRoot}\explorer.exe.

But recently we’ve made this much simpler in Liquit Workspace to use. Instead of using ${SystemRoot}\explorer.exe you can now use an action type called ‘Start Windows App’ and use the Package Family Name and Application Id to start the application:

The Package Family Name can be retrieved using:

 Get-AppxPackage | Where {$_.Name -match 'PowerBI'}

The Application Id can be retrieved using:

(Get-AppxPackage | Where {$_.Name -match 'PowerBI'} | Get-AppxPackageManifest).package.applications.application.id

Here’s the PowerShell script to create the Smart Icon. Spot the new parameters for New-LiquitAction (winapplaunch and settings) for the second action:

Import-Module "C:\Program Files (x86)\Liquit Workspace\PowerShell\3.0\Liquit.Server.PowerShell.dll" -Prefix "Liquit"

$liquitZoneUsername = "local\admin"
$liquitZonePassword = Read-Host "Enter Password" -AsSecureString
$liquitCredentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $liquitZoneUsername, $liquitZonePassword
$liquitZone = "https://yourliquitzone.liquit.com"

$powerBiIconUrl = "https://www.setupcommander.com/ico/pbidesktop.ico"
$powerBiIconPath = "c:\temp\pbidesktop.ico"

$tempDir = "c:\temp"
If(!(test-path $tempDir))
{
      New-Item -ItemType Directory -Force -Path $tempDir
}

$webClient = New-Object System.Net.WebClient
$webClient.DownloadFile($powerBiIconUrl, $powerBiIconPath)
$iconContent = New-LiquitContent -Path $powerBiIconPath

$packageName = "Power BI Desktop"
$packageDisplayName = "Power BI Desktop"
$packageDescription = ""

$liquitContext = Connect-LiquitWorkspace -URI $liquitZone -Credential $liquitCredentials

$package = New-LiquitPackage -Name $packageName `
                             -Type "Launch" `
                             -DisplayName $packageDisplayName `
                             -Description $packageDescription `
                             -Priority 100 `
                             -Enabled $true `
                             -Offline $True `
                             -Web $true `
                             -Icon $iconContent 

#create the snapshot for this package
$snapshot = New-LiquitPackageSnapshot -Package $package

#define launch action set
$actionset = New-LiquitActionSet -snapshot $snapshot `
                                 -Type Launch `
                                 -name 'Launch' `
                                 -Enabled $true `
                                 -Frequency Always `
                                 -Process StopAtFirstEffectiveAction

#
#define the first launch action
#
$actionset_action1 = New-LiquitAction -ActionSet $actionset `
                                      -Name 'Start PBIDesktop.exe' `
                                      -Type 'processstart' `
                                      -Enabled $true `
                                      -IgnoreErrors $false `
                                      -Settings @{name = '${ProgramFiles}\Microsoft Power BI Desktop\bin\PBIDesktop.exe'; parameters = "";} `
                                      -Context User


#define the filter set for the first action
$filterset1 = New-LiquitFilterSet -Action $actionset_action1

#add a filter to the first action
$filter1_1 = new-LiquitFilter -FilterSet $filterset1 -type fileexists -Settings @{path = '${ProgramFiles}\Microsoft Power BI Desktop\bin\PBIDesktop.exe';} -Value "true" 


#set the operator for the entity filter to AND
Set-LiquitEntityFilter -Action $actionset_action1 -Operator Or


#
#define the second launch action
#
$actionset_action2 = New-LiquitAction -ActionSet $actionset `
                                      -Name 'Start Windows App MicrosoftPowerBIDesktop' `
                                      -Type 'winapplaunch' `
                                      -Enabled $true `
                                      -IgnoreErrors $false `
                                      -Settings @{identity = 'Microsoft.MicrosoftPowerBIDesktop_8wekyb3d8bbwe'; application = "Microsoft.MicrosoftPowerBIDesktop"; parameters = "";} `
                                      -Context User

#define the filter set for the third action
$filterset2 = New-LiquitFilterSet -Action $actionset_action2

#add a filter to the first action
$filter2_1 = new-LiquitFilter -FilterSet $filterset2 -type winappinstalled -Settings @{identity = "Microsoft.MicrosoftPowerBIDesktop_8wekyb3d8bbwe";} -Value "true"
                                                                       
#
#define the third launch action
#
$actionset_action3 = New-LiquitAction -ActionSet $actionset `
                                      -Name 'Open Power BI online' `
                                      -Type 'openurl' `
                                      -Enabled $true `
                                      -IgnoreErrors $false `
                                      -Settings @{ url = 'https://app.powerbi.com/?noSignUpCheck=1'; browser = 0;} `
                                      -Context User


#publish the package
Publish-LiquitPackageSnapshot -Snapshot $snapshot -stage Production 

#set the entitlement
$identity = Get-LiquitIdentity -id "LOCAL\everyone"
New-LiquitPackageEntitlement -Package $package -Identity $identity -Publish Workspace

Recommended reading:

Application of the Week

MSIX related blogs

MSIX app attach related blogs

PowerShell examples using the Liquit PowerShell module

The best way to fully appreciate the power of the Liquit Digital Workspace is to see the above example and other features in action.

Book your demonstration today, where you will be joined by a Liquit expert who will take you on a guided tour of the Digital Workspace, demonstrating features and functionality, specifically focused on the needs and requirements of your organization.

About the author