Some Powershell love on the Metro style apps forum about the Appx cmdlets to deploy and inventory Appx packages
NOTE: I'm still looking for the official docs on MSDN. Don't laugh - there's a LOT of new documentation for the Developer Preview :-)
What cmdlets are available?
Use the
Get-Help Appx
command in Powershell to get the list of commands for Appx packages.
PowerShell cmd-lets are case-insensitive, or just type a partial command like
add-app
and hit Tab for Powershell to autocomplete the right cmd-let!
How do I install a package?
Use Add-AppxPackage to install a new package or update an existing one (i.e. install a newer version):
Add-AppxPackage C:\MyPackage.appx
How can I see all the packages installed?
Use Get-AppxPackage to inventory the installed packages:
Get-AppxPackage
PowerShell can pipe the results into filters like this for finding certain packages:
Get-AppxPackage | Where-Object {$_.Name -like "*wwa*" }
Get tired of typing? Too hard to see a big text list? Send it to PowerShell Grid-View and you get a UI for inventory with search!
Get-AppxPackage Out-GridView
Use variables to do things like get a quick count:
$packages = Get-AppxPackage
$packages.Count
How do I remove a package?
Removing an Appx package needs the Package Full Name. You can use variables again and inventory to help:
$toRemove = Get-AppxPackage | Where-Object {$_.Name -like "*wwa*" }
Remove-AppxPackage $toRemove.PackageFullName
So Cool, What else can I do with PowerShell?
How about sorting and getting a customized table of inventory with just Package Name and Install location:
Get-AppxPackage | Sort-Object Name | Format-Table Name,InstallLocation -Auto
Powershell makes it trivial to take inventory and generate an HTML file:
Get-AppxPackage | ConvertTo-Html | Set-Content temp.html
Since PowerShell knows how to navigate XML natively, you can even navigate the Package Manifest with PowerShell. Here is getting the App ID from an app you searched for!
$xml = Get-AppxPackage | Where-Object {$_.Name -like "*wwa*" } | Get-AppxPackageManifest
$xml.Package.Applications.Application.Id
How about navigating the event log to debug problems?
One of the most common things that everyone is looking for is event logs when things go wrong. With PowerShell, not only do you get better error messages directly from the AppX deployment engine, you can easily query for the last 10 ETW messages from the deployment engine!
Get-WinEvent -logname Microsoft-Windows-appx* | Select-Object -last 10 | Format-List -Property Message
The Appx cmdlets are built over the App Package and Deployment APIs, which are the heart of packaging manipulation and deployment in Windows 8. No smoke or mirrors or special magic. Just a convenient Powershell pathway to the awesomeness of the new packaging features in Windows 8.
Be sure to check out John Sheehan's session for more details:
PLAT-905C Under the hood: installation and updates for Metro style apps