Skip to content

Latest commit

 

History

History
53 lines (38 loc) · 2.09 KB

packagemanager_provisionpackageforallusersasync_653384863.md

File metadata and controls

53 lines (38 loc) · 2.09 KB
-api-id -api-type
M:Windows.Management.Deployment.PackageManager.ProvisionPackageForAllUsersAsync(System.String)
winrt method

Windows.Management.Deployment.PackageManager.ProvisionPackageForAllUsersAsync

-description

Enables an app Package to be installed for all users on a device.

-parameters

-param packageFamilyName

The FamilyName of the app package to be installed.

-returns

The progress and the result of the app package deployment.

-remarks

To provision a package you must be an administrator. The app package to be provisioned must be staged, and it must be on the system volume.

If the package is already provisioned, this performs a "clean" reprovision. A "clean" reprovision will remove all previous installs of this package so the package will behave as if this were its first installation.

Note

If you are provisioning optional packages, you must specify each optional package individually with its own method call. Starting with Windows Build 22000, you can use the overload of ProvisionPackageForAllUsersAsync, to specify additional optional packages to install with a single call.

-see-also

Package

-examples

This example demonstrates adding a staged or existing registered package for all users on a device.

using Windows.Foundation;
using Windows.Management.Deployment;

public void provisionForAllUsers(string inputPackageFamilyName)
{
    var packageManager = new PackageManager();
    var result = packageManager.ProvisionPackageForAllUsersAsync(inputPackageFamilyName).AsTask().Result;
    if (result.ExtendedErrorCode != null)
    {
        System.Console.WriteLine("Error {0} provisioning {1}", result, inputPackageFamilyName);
        throw result.ExtendedErrorCode.HResult;
    }
}