Accesing Metro via PowerShell-Appx Powershell Cmdlets

http://social.msdn.microsoft.com/Forums/en-US/toolsforwinapps/thread/5013262a-2a18-4ce6-99d1-03451d6c9619


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


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值