您的位置:首页 > 移动开发

How to Add and Remove Apps

2012-06-19 13:07 483 查看
http://technet.microsoft.com/en-us/library/hh852635.aspx

Published: February 29, 2012

Updated: May 31, 2012

Applies To: Windows 8

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

You can add line-of-business (LOB) Windows® Runtime-based apps to a Windows® image by using Windows PowerShell® or the Deployment Image Servicing and Management (DISM) platform. LOB Windows Runtime-based apps do not have to be certified
or installed through the Windows® Store, but they must be signed with a certificate that is chained to a trusted root certificate. Adding Windows Runtime-based apps that do not come from the Windows Store is called sideloading.
To install Windows Runtime-based apps that are not part of your business line, you must use the Windows Store.
The Dism.exe and Windows PowerShell commands only add, list, and remove Windows Runtime-based apps, you cannot use them to install traditional applications that can only be run on the desktop.
App Signing Requirements
You can install LOB Windows Runtime-based apps that are not signed by the Windows Store. LOB Windows Runtime-based apps must be cryptographically signed and can only be installed on a computer that trusts the signing certificate.
For more information about how to sign an app and using certificates, see App Packaging Tools.


Windows 8 Sideloading Requirements

Before you can add sideloaded LOB Windows Runtime-based apps to a Windows image:

You must enable the Allow all trusted applications to install Group Policy setting.

Before you can run sideloaded LOB Windows Runtime-based apps:

You must activate a sideloading product key or join the PC to an Active Directory domain that has the Allow all trusted applications to install Group Policy setting enabled.

You can enable sideloading on Windows® 8 Enterprise or Windows Server® 2012 by joining the PC to a domain. To enable sideloading on any other edition of Windows, or on a Windows 8 Enterprise PC that is not domain-joined, you must use a sideloading product activation
key.

Until the PC meets all of the sideloading requirements, app tiles on the Start menu will show an "X" in the bottom-right corner to indicate that a problem is preventing the app from running.


To set Group Policy for sideloading

Open the Group Policy editor (gpedit.msc). For example, on a computer that is running Windows 8, from the Start screen, type Edit Group Policy, click Settings, and then select the Edit Group Policy setting
from the search results.

Under Local Computer Policy in the left pane, click to expand Computer Configuration, Administrative Templates, Windows Components, and then App Package Deployment.

Double-click the Allow all trusted apps to install setting.

In the Allow all trusted apps to install window, click Enabled and then click OK.

Setting the Group Policy to allow trusted applications updates the following registry setting:HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Appx\AllowAllTrustedApps = 1


Add Apps

You can install an app package (.appx) on a per-user basis by using the add-appxpackage PowerShell cmdlet. These apps must be added for each user, but can roam with the user on to multiple PCs. There is no limit to the number of LOB apps you can
add for each user.


Add a LOB app to a user account

At the Windows PowerShell prompt on a Windows 8 or Windows Server 2012 computer, add a .appx file package. Include any required dependency app packages when you add the app. For example, type:

add-appxpackage C:\app1.appx –DependencyPath C:\winjs.appx


For more information, see App Installation Cmdlets in Windows PowerShell.

Provisioning LOB apps

Windows Runtime-based apps that are installed in the Windows image are called provisioned apps. Provisioned apps are staged in the image and are scheduled to be installed for every user of the Windows image at first logon.
You can add these apps to a Windows image when you boot into audit mode before you deploy the image by using the DISM app provisioning commands. For more information about audit mode, see Audit
Mode Overview.
Provisioned apps are specific to the PC and will not roam with the user. You can only install 24 provisioned apps in an image.
On a Windows image that has already been deployed, you should instead use the Add-AppxPackage cmdlet in Windows PowerShell. If you do use the DISM app provisioning commands on a deployed Windows image with active users, you should
log all users off of the image before you run the command.
To update a provisioned app, you must remove the provisioned app and then deploy the new version of the app. The update will then be applied the next time each user logs in.


Add a provisioned LOB app to a Windows image

Use the Deployment Image Servicing and Management (DISM) command-line tool or PowerShell cmdlets to add the LOB app without a Windows store license. For example, at an elevated command prompt, type:

DISM /Online /Add-ProvisionedAppxPackage /PackagePath:C:\App1.appx /SkipLicense


Or, at a Windows PowerShell prompt, type:

Add-AppxProvisionedPackage -Online -FolderPath C:\Appx


For more information, see App Package (.appx) Servicing Command-Line Options or DISM
Cmdlets. For information about DISM supported platforms, see DISM Supported Platforms.


Note
The computer does not have to be joined to a domain or have an activated sideloading product key before you install provisioned LOB apps. However, the apps will not run until the computer meets this sideloading requirement. For more information, see How
to Customize the Start Screen.


Inventory Apps

You can list the LOB Windows Runtime-based apps installed in on offline or online Windows image and get additional information about the packages.


List LOB Apps per user account

You can get a list of the modern LOB Windows Runtime-based apps installed for a specific user account on the computer. You must open Windows PowerShell with administrator privileges to list the packages for a user other than the current user. For example,
at the Windows PowerShell prompt, type:

Get-AppxPackage -AllUsers


You can get a list of packages installed for a specific user. You must open Windows PowerShell with administrator privileges to list the packages for a user other than the current user. For example, at the Windows PowerShell prompt, type:

Get-AppxPackage -Name Package1 -User domain\username


You can also get the manifest of an AppX package which includes information such as the package ID. For example, at the Windows PowerShell prompt, type:

Get-AppxPackageManifest -Package Package1


You can use piping to get the manifest for an AppX package if you don’t know the full name of the package. For example, at the Windows PowerShell prompt, type:

(Get-AppxPackage -Name "*WinJS*" | Get-AppxPackageManifest).package.applications.application.id



List LOB apps that are provisioned in a Windows image

You can get a list of the packages that are provisioned in a Windows image that will be installed for each new user by using Dism.exe or Windows PowerShell. For example, at a Windows PowerShell prompt, type:

Get-AppxProvisionedPackage -Path c:\offline


Or, at a command prompt, type:

DISM.exe /Image:C:\test\offline /Get-ProvisionedAppxPackages


For more information, see How to Take Inventory of an Image or Component.


Remove Apps

You can remove individual instances of an app, or remove the provisioning setting of an app.


Remove LOB apps per user account

You can remove a single app for the current user only. For example, at a command prompt, type:

Remove-AppxPackage Package1



Remove provisioned LOB apps in a Windows image

When you remove a provisioned app, the app is removed for the current user, and will not be installed for new user accounts. If there are other user accounts that are active on the computer, the application will not be removed from those accounts.

For example, at an elevated Windows PowerShell prompt, type:

Remove-AppxProvisionedPackage -Online -PackageName MyAppxPkg


Or, at a command prompt, type:

DISM.exe /Online /Remove-ProvisionedAppxPackage /PackageName:microsoft.app1_1.0.0.0_neutral_en-us_ac4zc6fex2zjp
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: