Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # (Offline-)Install an .appinstaller package for all users on a computer
- # Prep
- Add-Type -AssemblyName System.Web
- if (-not (Test-Path "C:\Install\KeeperPasswordManagerFiles")) {
- mkdir "C:\Install\KeeperPasswordManagerFiles"
- }
- curl.exe -L "https://download.keepersecurity.com/desktop_electron/packages/KeeperPasswordManager.appinstaller" -o "C:\Install\KeeperPasswordManager.appinstaller" --ssl-no-revoke --fail-with-body
- [xml]$ai_xml = Get-Content "C:\Install\KeeperPasswordManager.appinstaller" -Raw
- # Download deps
- Push-Location C:\Install\KeeperPasswordManagerFiles\ -ErrorAction Stop
- [System.Environment]::CurrentDirectory = Get-Location
- $ai_xml.AppInstaller.Dependencies.Package.Uri | % {
- $encoded = [System.Web.HttpUtility]::UrlPathEncode($_)
- curl.exe -LO "$encoded" --ssl-no-revoke --fail-with-body
- }
- Get-ChildItem
- # Main app
- $appname = $ai_xml.AppInstaller.MainBundle.Name
- $dl_url = $ai_xml.AppInstaller.MainBundle.Uri
- $encoded_dl_url = [System.Web.HttpUtility]::UrlPathEncode($dl_url)
- curl.exe -LO "$encoded_dl_url" --ssl-no-revoke --fail-with-body
- # Install
- $depsList = @(ls C:\Install\KeeperPasswordManagerFiles\ | Where Extension -notlike ".msixbundle")
- $mainapp = ls C:\Install\KeeperPasswordManagerFiles\ | Where Extension -like ".msixbundle"
- Write-Output "Mainapp:"
- $mainapp.FullName
- Write-Output "DepsList:"
- $depsList.FullName
- try {
- Add-AppxProvisionedPackage -Online -PackagePath $mainapp.FullName -DependencyPackagePath $depsList.FullName -Verbose -SkipLicense
- } catch {
- $_ | Select-Object * | Format-List *
- Write-Error $_
- }
- Pop-Location
- [System.Environment]::CurrentDirectory = Get-Location
- # Verify app is provisioned to be installed for all (new?) users
- Get-AppxProvisionedPackage -Online | ? DisplayName -like "$appname"
- # Verify app is installed for the current user
- Get-AppxPackage | ? Name -like "$appname"
- # Check for which users the app has already been installed (likely only current if any?)
- # Note: Info is in PackageUserInformation property
- Get-AppxPackage -AllUsers | ? Name -like "$appname"
Advertisement
Add Comment
Please, Sign In to add comment