1

I use installing of my UWP application via .appinstaller file: Read more about this approach

But now the installation works only for current user. Could I somehow install my app throw .appinstaller to all users on machine?

Edit:

You have not this package on your hands. It is located at server and all you have is uri for running appinstaller file.

Thanks in advance.

pavel
  • 1,736
  • 1
  • 14
  • 23

2 Answers2

1

You cannot do this from a package manually installed (double clicked) by an user.

System wide deployments are available only if you use Microsoft's DISM tooling. More details:

Bogdan Mitrache
  • 10,536
  • 19
  • 34
  • thank you for this info! so, how can I understand there are no way to install it per-machine via appinstaller file? – pavel May 14 '18 at 11:32
  • @PavelBasha "how can I understand there are no way to install it per-machine via appinstaller file" what does this mean? Did you mean copy the install files to one machine for installing? If in this case, copy install files to one machine for one user to install should work. – Sunteen Wu May 28 '18 at 08:28
  • @Bogdan Okay. Let say, I have application on the server and I want to install this app via APP INSTALLER (!). And when I install this app by link it deploys on current user only. That means if I log out from current user and log in to another (on the same machine) I won't have installed app for this user. And I try to find the way when I can install this app via appinstaller and it will installed for all users – pavel May 29 '18 at 08:57
0

Five years later, chatGPT produced for me the following powershell script, which takes an AppInstaller path as a parameter and installs it for all users:

# Define the path to the AppInstaller XML File
param([String]$xmlFilePath)

# Define the directory for downloads
$downloadDirectory = "C:\AppInstallerTemp"
cmd.exe /c mkdir $downloadDirectory

# Supresses slow powershell GUI
$ProgressPreference = 'SilentlyContinue'

# Load the XML file
$xml = [xml](Get-Content $xmlFilePath)

# Get the Uri for the MainBundle
$mainBundleUri = $xml.AppInstaller.MainBundle.Uri

# Define the XML namespace
$namespaceStr = $xml.AppInstaller.xmlns
$namespace = New-Object Xml.XmlNamespaceManager($xml.NameTable)
$namespace.AddNamespace("ns", $namespaceStr)

# Download the MainBundle
$mainBundleFileName = "MainBundle.msixbundle"
$mainBundlePath = "$downloadDirectory\$mainBundleFileName"
Invoke-WebRequest -Uri $mainBundleUri -OutFile $mainBundlePath

# Get the Uri for dependencies with ProcessorArchitecture="x64"
$dependencies = $xml.SelectNodes("//ns:Dependencies/ns:Package[@ProcessorArchitecture='x64']", $namespace)

# Download and get the dependency paths for installation
$dependencyPaths = @()
foreach ($dependency in $dependencies) {
    $dependencyUri = $dependency.Uri
    $dependencyFileName = ($dependencyUri -split '/')[-1]
    $dependencyPath = "$downloadDirectory\$dependencyFileName"
    Invoke-WebRequest -Uri $dependencyUri -OutFile $dependencyPath
    $dependencyPaths += $dependencyPath
}

# Install the MainBundle and add dependencies to the dependency path list
Add-AppxProvisionedPackage -Online -PackagePath $mainBundlePath -DependencyPackagePath $dependencyPaths -SkipLicense

# Cleans up temp files
cmd.exe /c rd /s /q $downloadDirectory

# Forces install for other users
Get-AppXPackage -allusers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

Write-Host "Installation completed."
Swise
  • 1
  • 1
  • Using ChatGPT to post answers is not allowed. See https://meta.stackoverflow.com/questions/421831/temporary-policy-chatgpt-is-banned – Eric Aya Jul 27 '23 at 05:14