Application of the Week – Netflix (Part 2)

Thank you for your feedback and comments on Application of the Week – Netflix (Part 1). It seems you all spend a lot of time on creating these kind of packages for Microsoft Store apps.

Therefore in this week’s blog I will throw in some PowerShell magic and some Liquit Workspace Smart icon magic to simplify this task to create a Liquit Workspace package for Netflix. At the end of the blog I’ve included the full PowerShell script, so you can copy and paste it in Windows Powershell ISE and run it from there.

This section searches for the Appx details of the Netflix app to be used for the arguments passed to explorer.exe:

Import-Module "C:Program Files (x86)Liquit WorkspacePowerShell3.0Liquit.Server.PowerShell.dll" -Prefix "Liquit"

$windowsApp = Get-AppxPackage | Where {$_.Name -match 'Netflix'} 
$windowsAppFamilyName = $windowsApp.PackageFamilyName
$windowsAppApplicationId = (Get-AppxPackage | Where {$_.Name -match 'Netflix'} | Get-AppxPackageManifest).package.applications.application.id 
$windowsAppInstallLocation = $windowsApp.InstallLocation
$windowsAppIconPath = $windowsAppInstallLocation + "imagespackageSquare.310x310.scale-400.png"

$liquitLaunchParm = "Shell:AppsFolder" + "" + $windowsAppFamilyName + "!" + $windowsAppApplicationId


Then this part is something we’ve seen before. This is where you define your Liquit zone URL and the credentials to get access to that zone:

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


Here’s where we define the details for the package; the name, the icon, display name and description:

$packageIconContent = New-LiquitContent -Path $windowsAppIconPath
$packageName = "Netflix"
$packageDisplayName = "Netflix"
$packageDescription = "Netflix"


Next we connect to the Liquit zone and define the properties for the Netflix package:

$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 $false `
                             -Icon $packageIconContent


This defines the first Action Set which takes care of Launching the Netflix Windows app as described in Part 1, including a filter which checks whether the Netflix Windows app actually has been installed:

$snapshot = New-LiquitPackageSnapshot -Package $package

#define the 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 Windows App' `
                                      -Type 'processstart' `
                                      -Enabled $true `
                                      -IgnoreErrors $false `
                                      -Settings @{name = '${SystemRoot}explorer.exe'; parameters = $liquitLaunchParm;} `
                                      -Context User

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

#add a filter to the first action
$filter = new-LiquitFilter -FilterSet $filterset -type fileexists -Settings @{path = $windowsAppInstallLocation + "AppxManifest.xml";} -Value "true"

Now we also bring in some ‘Smart icon’ magic by defining a second launch action:

#define the second launch action
$actionset_action2 = New-LiquitAction -ActionSet $actionset `
                                      -Name 'Launch Netflix URL' `
                                      -Type 'openurl' `
                                      -Enabled $true `
                                      -IgnoreErrors $false `
                                      -Settings @{url = 'https://www.netflix.com'; browser = 0;} `
                                      -Context User


‘Stop at first effective action’ has been set for this action set. This means that if the first action, which tries to launch the Netflix Window app, is not run because the app simply is not there, it will try the second action. That’s why the filter for the AppxManifest.xml has been added; if that file doesn’t exist the Windows app is not installed.

The Browser being used to launch the URL can be your default browser (browser = 0), but can also be Internet Explorer (browser = 1) Firefox (browser = 2) etc:

And that’s it! The only thing left is to publish this package and set the entitlement(s) to show up in either the Catalog or the user’s Workspace:

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

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


Scripto ergo sum! 🙂

Next week in ‘Part 3’ of this blog I will discuss and describe how to download the Netflix Appx package for offline use through the Microsoft Store for Business and Education and deploy the Appx package using Liquit Workspace.

Import-Module "C:Program Files (x86)Liquit WorkspacePowerShell3.0Liquit.Server.PowerShell.dll" -Prefix "Liquit"

$windowsApp = Get-AppxPackage | Where {$_.Name -match 'Netflix'} 
$windowsAppFamilyName = $windowsApp.PackageFamilyName
$windowsAppApplicationId = (Get-AppxPackage | Where {$_.Name -match 'Netflix'} | Get-AppxPackageManifest).package.applications.application.id 
$windowsAppInstallLocation = $windowsApp.InstallLocation
$windowsAppIconPath = $windowsAppInstallLocation + "imagespackageSquare.310x310.scale-400.png"

$liquitLaunchParm = "Shell:AppsFolder" + "" + $windowsAppFamilyName + "!" + $windowsAppApplicationId

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

$packageIconContent = New-LiquitContent -Path $windowsAppIconPath
$packageName = "Netflix"
$packageDisplayName = "Netflix"
$packageDescription = "Netflix"

$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 $false `
                             -Icon $packageIconContent

#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 Windows App' `
                                      -Type 'processstart' `
                                      -Enabled $true `
                                      -IgnoreErrors $false `
                                      -Settings @{name = '${SystemRoot}explorer.exe'; parameters = $liquitLaunchParm;} `
                                      -Context User

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

#add a filter to the first action
$filter = new-LiquitFilter -FilterSet $filterset -type fileexists -Settings @{path = $windowsAppInstallLocation + "AppxManifest.xml";} -Value "true"

#define the second launch action
$actionset_action2 = New-LiquitAction -ActionSet $actionset `
                                      -Name 'Launch Netflix URL' `
                                      -Type 'openurl' `
                                      -Enabled $true `
                                      -IgnoreErrors $false `
                                      -Settings @{ url = 'https://www.netflix.com'; browser = 0;} `
                                      -Context User

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

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