I wrote a function called Get-ProgramUwp for retreiving informations from UWP app (app sanboxed, from Windows store), like URI schemes and Shell Namespace Identifier, in order to easily start an app with it's name :
function Get-ProgramUwp {
[CmdletBinding()]
param (
[Parameter(Mandatory=$False, ValueFromPipeline=$true)]
[string]$Name = "*"
)
Write-Verbose "Getting UWP app informations (Universal Windows Platform app)"
# Retrieve all UWP apps matching the name (wildcard support)
$packages = Get-AppxPackage $Name
if ($packages.Count -eq 0) {
Write-Verbose "No package found matching '$Name' (Universal Windows Platform (UWP) app)"
return
}
# Prepare output array
$ProgramUwpArray = @()
foreach ($package in $packages) {
Write-Verbose "> Processing package: '$($package.PackageFullName)'"
# Define path to AppxManifest.xml
$manifestPath = Join-Path $package.InstallLocation "AppxManifest.xml"
if (-Not (Test-Path $manifestPath)) {
Write-Verbose " Manifest not found for package '$($package.Name)'"
continue
} else {
Write-Verbose " Manifest found for package: '$manifestPath'"
}
# Load the manifest XML, handling namespaces
try {
[xml]$manifest = Get-Content -Path $manifestPath
$namespaceManager = New-Object System.Xml.XmlNamespaceManager($manifest.NameTable)
$namespaceManager.AddNamespace('def', $manifest.DocumentElement.NamespaceURI)
$namespaceManager.AddNamespace('uap', 'http://schemas.microsoft.com/appx/manifest/uap/windows10')
$namespaceManager.AddNamespace('uap3', 'http://schemas.microsoft.com/appx/manifest/uap/windows10/3')
} catch {
Write-Verbose " Failed to load manifest for package: $($package.Name)"
continue
}
# Extract the Application Name (DisplayName from manifest, or fallback to package name)
$appDisplayName = $manifest.SelectSingleNode('//def:DisplayName', $namespaceManager).InnerText
if (-not $appDisplayName) {
Write-Verbose " No DisplayName found in manifest, using package name: $($package.Name)"
$appDisplayName = $package.Name
}
# Extract the Application Publisher from manifest
$appPublisherDisplayName = $manifest.SelectSingleNode('//def:PublisherDisplayName', $namespaceManager).InnerText
# Extract Application ID and EntryPoint (with proper namespace handling)
$applicationNode = $manifest.SelectSingleNode('//def:Applications/def:Application', $namespaceManager)
if ($applicationNode) {
$appId = $applicationNode.GetAttribute("Id")
$appExecutable = $applicationNode.GetAttribute("Executable")
$appEntryPoint = $applicationNode.GetAttribute("EntryPoint")
}
# Extract the Application Description from manifest
$VisualElementsNode = $manifest.SelectSingleNode('//uap:VisualElements', $namespaceManager)
if ($VisualElementsNode) { $Description = $VisualElementsNode.GetAttribute("Description") }
# Extract all registered URI schemes with their parameters (from both uap and uap3 namespaces)
$uriSchemes = @()
$protocolNodes = $manifest.SelectNodes('//uap:Extension[@Category="windows.protocol"]/uap:Protocol', $namespaceManager) +
$manifest.SelectNodes('//uap3:Extension[@Category="windows.protocol"]/uap3:Protocol', $namespaceManager)
if ($protocolNodes) {
foreach ($protocolNode in $protocolNodes) {
$uriSchemeName = $protocolNode.GetAttribute("Name")
$uriSchemeParameters = $protocolNode.GetAttribute("Parameters")
# Add each protocol as a PSCustomObject with Name and Parameters
if ($uriSchemeName) {
$uriSchemes += [PSCustomObject]@{
Name = $uriSchemeName
Parameters = $uriSchemeParameters
}
}
}
}
# Construct the Shell Namespace Identifier to launch the app
$ShellNamespaceIdentifier = "appsFolder\$($package.PackageFamilyName)!$appId"
# Create a PSCustomObject to hold the output data, including URI schemes and command-line parameters
$ProgramUwp = [PSCustomObject]@{
DisplayName = $appDisplayName
Publisher = $appPublisherDisplayName
Version = $package.Version
Architecture = $package.Architecture
Description = $Description
AppId = $appId
Executable = $appExecutable
EntryPoint = $appEntryPoint
ShellNamespaceIdentifier = $ShellNamespaceIdentifier
UriSchemes = $uriSchemes
}
$ProgramUwpArray += $ProgramUwp
}
$ProgramUwpArray
}
Here is an example of use for QuickAssist :
> Get-ProgramUWP *quickassist*
DisplayName : ms-resource://MicrosoftCorporationII.QuickAssist/resources/APP_WINDOW_NAME
Publisher : Microsoft Corp.
Version : 2.0.32.0
Architecture : X64
Description : ms-resource://MicrosoftCorporationII.QuickAssist/resources/APP_WINDOW_NAME
AppId : App
Executable : Microsoft.RemoteAssistance.QuickAssist\QuickAssist.exe
EntryPoint : Windows.FullTrustApplication
ShellNamespaceIdentifier : appsFolder\MicrosoftCorporationII.QuickAssist_8wekyb3d8bbwe!App
UriSchemes : {@{Name=ms-quick-assist; Parameters=%1; EntryPoint=}}
Notice that QuickAssist can be launch with it's NameSpace Identifier with this command :
explorer shell:appsFolder\MicrosoftCorporationII.QuickAssist_8wekyb3d8bbwe!App
or simply :
explorer shell:$((Get-ProgramUWP *quick*assist*).ShellNamespaceIdentifier)
To be sure that function find an app by it's name, surround the name and replace spaces with the generic character "*".
The same example with the first URI scheme:
explorer $((Get-ProgramUWP *quick*assist*).UriSchemes[0].Name:$aParameter)
Hope this help