Application of the week > Application of the Week – Deezer

Today we published ‘Application of the Week – Netflix (Part 2)‘. After hitting ‘Publish’, I took a deep breath, grabbed a cup of coffee, got back to my desk and found an e-mail of someone who asked me whether this can be used to create a Package for Deezer too.

Sure, that’s why the scripts given are just examples for you to tweak as you like, examples of what can be done using PowerShell with Liquit Workspace. Here’s the bonus for today; scripto ergo sum!

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

$windowsApp = Get-AppxPackage | Where {$_.Name -match 'Deezer'} 
$windowsAppFamilyName = $windowsApp.PackageFamilyName
$windowsAppApplicationId = (Get-AppxPackage | Where {$_.Name -match 'Deezer'} | Get-AppxPackageManifest).package.applications.application.id 
$windowsAppInstallLocation = $windowsApp.InstallLocation
$windowsAppIconPath = $windowsAppInstallLocation + "\assets\Square150x150Logo.scale-200.png"

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

$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"

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

$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 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

$filterset = New-LiquitFilterSet -Action $actionset_action1
$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 Deezer URL' `
                                      -Type 'openurl' `
                                      -Enabled $true `
                                      -IgnoreErrors $false `
                                      -Settings @{url = 'https://www.deezer.com/en'; 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
About the author