Skip to content

Instantly share code, notes, and snippets.

@shannonfritz
Last active March 3, 2025 22:11
Show Gist options
  • Select an option

  • Save shannonfritz/e35b64dda22d16950ccca543cc2a6c71 to your computer and use it in GitHub Desktop.

Select an option

Save shannonfritz/e35b64dda22d16950ccca543cc2a6c71 to your computer and use it in GitHub Desktop.
Launcher for the Quick Assist Store App
# Quick Assist App Launcher v0.02
# To easily run Quick Assist from a command prompt, first
# Save this script to 'c:\windows\system32\quickassist.ps1', then
# Copy the next line to 'c:\windows\system32\quickassist.cmd'
# @powershell.exe -executionpolicy remotesigned -command "%windir%\system32\quickassist.ps1"
# from a comand prompt, just type 'quickassist' to run the cmd which will run the ps1
$whoiam = [system.security.principal.windowsidentity]::getcurrent().name
$AppName = "Quick Assist"
$PkgName = 'MicrosoftCorporationII.QuickAssist'
#$PkgName = "*quickassist*"
# Is the app package added for the user running this script?
$Package = Get-AppxPackage -Name $PkgName -ErrorAction SilentlyContinue
if ($Package.Version) {
Write-Host "$whoiam has $AppName $($Package.Version) available"
} else {
Write-Host "$whoiam does NOT have $AppName available"
# Is the App on this device?
$Package = Get-AppxPackage -AllUsers -Name $PkgName -ErrorAction SilentlyContinue
if ($Package.Version) {
Write-Host "This device has $AppName $($Package.Version) available"
# Try to add the app for the user
$ManifestPath = (Get-AppxPackage -AllUsers -Name "$PkgName").InstallLocation + "\Appxmanifest.xml"
Add-AppxPackage -Path $ManifestPath -Register -DisableDevelopmentMode
# check our work...
$Package = Get-AppxPackage -Name $PkgName -ErrorAction SilentlyContinue
if ($Package.Version) {
Write-Host "Sucessfully added $AppName $($Package.Version) for $whoiam"
} else {
Write-Host "Failed to add $AppName for $whoiam"
}
} else {
Write-Host "This device does NOT have $AppName available"
}
}
# Testing?
# Remove-AppxPackage -Package $(Get-AppxPackage -Name *quickassist*)
if ($Package.PackageFamilyName) {
# NOTE: The app seem to run in the context of whatever user owns the already running explorer.exe process
# Even when running this script as a different (admin) user, the spawned process will be the other user.
# Let's check so we can warn if it looks odd...
# Who is running explorer.exe? (it could be many users but we don't really deal with that)
$exeOwners = @(Get-WmiObject -Class Win32_Process -Filter 'Name="explorer.exe"' | ForEach-Object { $_.GetOwner() })
$loggedOnUsers = @()
foreach ($owner in $exeOwners) {
$loggedOnUsers += ('{0}\{1}' -f ($owner |Select-Object -Unique -ExpandProperty Domain),($owner |Select-Object -Unique -ExpandProperty User))
}
if ($whoiam -eq $loggedOnUsers[0]) {
Write-Host "Starting $AppName for $whoiam"
} else {
#NOTE: I should probably make sure that user has the app added as well...
Write-Warning "explorer.exe is running as a different user! $AppName will run as that user..."
Write-Host "Starting $AppName for $($loggedOnUsers[0])"
}
Start-Process 'explorer.exe' -ArgumentList "shell:AppsFolder\$($Package.PackageFamilyName)!App"
} else {
Write-Host "Unable to start $AppName for $whoiam"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment