New in version 3007.0.
Provisioned apps are part of the image and are installed for every user the first time the user logs on. Provisioned apps are also updated and sometimes reinstalled when the system is updated.
Apps removed with this module will remove the app for all users and deprovision the app. Deprovisioned apps will neither be installed for new users nor will they be upgraded.
An app removed with this module can only be re-provisioned on the machine, but it can't be re-installed for all users. Also, once a package has been deprovisioned, the only way to reinstall it is to download the package. This is difficult. The steps are outlined below:
Open the page for the app in the Microsoft Store
Click the share button and copy the URL
Ensure URL (link)
is selected in the first dropdown
Paste the URL in the search field
Ensure Retail is selected in the 2nd dropdown
Click the checkmark button
This should return a list of URLs for the package and all dependencies for all architectures. Download the package and all dependencies for your system architecture. These will usually have one of the following file extensions:
.appx
.appxbundle
.msix
.msixbundle
Dependencies will need to be installed first.
Not all packages can be found this way, but it seems like most of them can.
Use the appx.install
function to provision the new app.
This function uses dism
to provision a package. This means that it will
be made a part of the online image and added to new users on the system. If
a package has dependencies, those must be installed first.
If a package installed using this function has been deprovisioned previously, the registry entry marking it as deprovisioned will be removed.
Note
There is no appx.present
state. Instead, use the
dism.provisioned_package_installed
state.
package (str) --
The full path to the package to install. Can be one of the following:
.appx
or .appxbundle
.msix
or .msixbundle
.ppkg
True
if successful, otherwise False
CLI Example:
salt "*" appx.install "C:\Temp\Microsoft.ZuneMusic.msixbundle"
Get a list of Microsoft Store packages installed on the system.
query (str) --
The query string to use to filter packages to be listed. The string
can match multiple packages. None
will return all packages. Here
are some example strings:
*teams*
- Returns Microsoft Teams
*zune*
- Returns Windows Media Player and ZuneVideo
*zuneMusic*
- Only returns Windows Media Player
*xbox*
- Returns all xbox packages, there are 5 by default
*
- Returns everything but the Microsoft Store, unless
include_store=True
field (str) --
This function returns a list of packages on the system. It can
display a short name or a full name. If None
is passed, a
dictionary will be returned with some common fields. The default is
Name
. Valid options are any fields returned by the powershell
command Get-AppxPackage
. Here are some useful fields:
Name
Version
PackageFullName
PackageFamilyName
include_store (bool) -- Include the Microsoft Store in the results. Default is False
frameworks (bool) -- Include frameworks in the results. Default is False
bundles (bool) -- If True
, this will return application bundles only. If
False
, this will return individual packages only, even if they
are part of a bundle.
A list of packages ordered by the string passed in field
list: A list of dictionaries of package information if field is None
CommandExecutionError -- If an error is encountered retrieving packages
CLI Example:
# List installed apps that contain the word "candy"
salt '*' appx.list *candy*
# Return more information about the package
salt '*' appx.list *candy* field=None
# List all installed apps, including the Microsoft Store
salt '*' appx.list include_store=True
# List all installed apps, including frameworks
salt '*' appx.list frameworks=True
# List all installed apps that are bundles
salt '*' appx.list bundles=True
When an app is deprovisioned, a registry key is created that will keep it from being reinstalled during a major system update. This function returns a list of keys for apps that have been deprovisioned.
query (str) --
The query string to use to filter packages to be listed. The string
can match multiple packages. None
will return all packages. Here
are some example strings:
*teams*
- Returns Microsoft Teams
*zune*
- Returns Windows Media Player and ZuneVideo
*zuneMusic*
- Only returns Windows Media Player
*xbox*
- Returns all xbox packages, there are 5 by default
*
- Returns everything but the Microsoft Store, unless
include_store=True
A list of packages matching the query criteria
CLI Example:
salt "*" appx.list_deprovisioned *zune*
Removes Microsoft Store packages from the system. If the package is part of a bundle, the entire bundle will be removed.
This function removes the package for all users on the system. It also
deprovisions the package so that it isn't re-installed by later system
updates. To only deprovision a package and not remove it for all users, set
deprovision_only=True
.
query (str) --
The query string to use to select the packages to be removed. If the string matches multiple packages, they will all be removed. Here are some example strings:
*teams*
- Remove Microsoft Teams
*zune*
- Remove Windows Media Player and ZuneVideo
*zuneMusic*
- Only remove Windows Media Player
*xbox*
- Remove all xbox packages, there are 5 by default
*
- Remove everything but the Microsoft Store, unless
include_store=True
Note
Use the appx.list
function to make sure your query is
returning what you expect. Then use the same query to remove
those packages
include_store (bool) -- Include the Microsoft Store in the results of the query to be
removed. Use this with caution. It is difficult to reinstall the
Microsoft Store once it has been removed with this function. Default
is False
frameworks (bool) -- Include frameworks in the results of the query to be removed.
Default is False
deprovision_only (bool) -- Only deprovision the package. The package will be removed from the
current user and added to the list of deprovisioned packages. The
package will not be re-installed in future system updates. New users
of the system will not have the package installed. However, the
package will still be installed for existing users. Default is
False
True
if successful, None
if no packages found
CommandExecutionError -- On errors encountered removing the package
CLI Example:
salt "*" appx.remove *candy*