Partager via


Powershell fun - Parsing for Protocols

I was looking for what protocols are registered by my installed AppX packages and figured out a 1-liner Powershell script to do it

powershell -c "foreach ($p in $(get-appxpackage)) { foreach ($n in (Get-AppxPackageManifest $p).package.applications.application.extensions.extension.protocol.name) { $n + ' -- ' + $p.packagefullname } }"

Hey, I never said it'd be pretty :-)

This dumps

 Get-AppxPackageManifest : The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
At line:1 char:54
+ foreach ($p in $(get-appxpackage)) { foreach ($n in (Get-AppxPackageManifest $p) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : NotSpecified: (:) [Get-AppxPackageManifest], FileNotFoundException
 + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.Windows.Appx.PackageManager.Commands.GetAppxPackageManifestCommand

bingmaps -- Microsoft.BingMaps_1.5.1.240_x64__8wekyb3d8bbwe
xboxgames -- Microsoft.XboxLIVEGames_1.1.134.0_x64__8wekyb3d8bbwe
microsoftvideo -- Microsoft.ZuneVideo_1.1.134.0_x64__8wekyb3d8bbwe
bingsearch -- Microsoft.Bing_1.5.1.259_x64__8wekyb3d8bbwe
bingweather -- Microsoft.BingWeather_1.7.0.26_x64__8wekyb3d8bbwe
bingtravel -- Microsoft.BingTravel_1.7.0.26_x64__8wekyb3d8bbwe
xboxliveapp-1496516562 -- HalfbrickStudiosPtyLtd.JetpackJoyride_1.0.3.48_x86__w77bc8x1h5kya
microsoftmusic -- Microsoft.ZuneMusic_1.1.144.0_x64__8wekyb3d8bbwe
npe -- 50582LuanNguyen.NuGetPackageExplorer_1.1.0.9_neutral__w6y2tyx5bpzwa
bingsports -- Microsoft.BingSports_1.8.0.51_x64__8wekyb3d8bbwe
bingfinance -- Microsoft.BingFinance_1.7.0.38_x64__8wekyb3d8bbwe
bingnews -- Microsoft.BingNews_1.7.0.38_x64__8wekyb3d8bbwe
moderndilbert -- 24632RobPaveza.ModernDilbertReader_1.3.1.0_neutral__tpjz84vefy3e6
xboxliveapp-1297290206 -- Microsoft.Adera_1.3.0.14265_x86__8wekyb3d8bbwe
lync15 -- Microsoft.LyncMX_15.0.4481.1503_x64__8wekyb3d8bbwe
lync15mlx -- Microsoft.LyncMX_15.0.4481.1503_x64__8wekyb3d8bbwe
skype -- Microsoft.SkypeApp_1.5.0.109_x86__kzf8qxf38zg5c
tel -- Microsoft.SkypeApp_1.5.0.109_x86__kzf8qxf38zg5c
sms -- Microsoft.SkypeApp_1.5.0.109_x86__kzf8qxf38zg5c
message-skype-com -- Microsoft.SkypeApp_1.5.0.109_x86__kzf8qxf38zg5c
message-messenger -- Microsoft.SkypeApp_1.5.0.109_x86__kzf8qxf38zg5c
audiocall-messenger -- Microsoft.SkypeApp_1.5.0.109_x86__kzf8qxf38zg5c
videocall-messenger -- Microsoft.SkypeApp_1.5.0.109_x86__kzf8qxf38zg5c
audiocall-skype-com -- Microsoft.SkypeApp_1.5.0.109_x86__kzf8qxf38zg5c
videocall-skype-com -- Microsoft.SkypeApp_1.5.0.109_x86__kzf8qxf38zg5c
xboxliveapp-1297290209 -- Microsoft.Studios.PinballFx2_1.4.0.486_x86__8wekyb3d8bbwe
kindle -- AMZNMobileLLC.KindleforWindows8_1.1.3.0_neutral__stfe6vwa9jnbp
ebay -- eBayInc.eBay_1.2.1.65_neutral__1618n3s9xq8tw
maps -- 17655DreamTeamMobile.gMaps_1.4.0.56_x64__drr96ftsfk4j0
gmaps -- 17655DreamTeamMobile.gMaps_1.4.0.56_x64__drr96ftsfk4j0
geo -- 17655DreamTeamMobile.gMaps_1.4.0.56_x64__drr96ftsfk4j0
ms-drive-to -- 17655DreamTeamMobile.gMaps_1.4.0.56_x64__drr96ftsfk4j0
ms-walk-to -- 17655DreamTeamMobile.gMaps_1.4.0.56_x64__drr96ftsfk4j0
ms-bike-to -- 17655DreamTeamMobile.gMaps_1.4.0.56_x64__drr96ftsfk4j0
ms-transit-to -- 17655DreamTeamMobile.gMaps_1.4.0.56_x64__drr96ftsfk4j0
onenote -- Microsoft.Office.OneNote_15.0.4505.1000_x64__8wekyb3d8bbwe
mhmtodo -- MapletonHillMedia.MinimaList_0.0.0.131_neutral__fw9m7z2jr9vjg
xboxliveapp-1297290225 -- Microsoft.MicrosoftMahjong_1.6.0.30312_x86__8wekyb3d8bbwe
mailto -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
ms-mail -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
wlcalendar -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
wlpeople -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
profile-messenger -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
profile-outlook-com -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
profile-skype-com -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
profile-facebook-com -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
profile-twitter-com -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
profile-google-com -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
profile-weibo-com -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
profile-linkedin-com -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
profile-yahoo-com -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
profile-lync-com -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
mschat -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
message-messenger -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
message-facebook-com -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
message-yahoo-com -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
message-lync-com -- microsoft.windowscommunicationsapps_17.0.1114.318_x64__8wekyb3d8bbwe
netflix -- 4DF9E0F8.Netflix_1.7.0.39_x64__mcm4njqhnhss8

Looks like one of the packages is missing its manifest. That's probably some incomplete VS project I've got laying around.

This isn't unique to protocols. Change the " .package...protocol.name" to whatever you're interested in. Most samples on the net are interested in the applications' id, i.e. ".package.applications.application.id"

P.S. Bonus points if you can tell me how to get that output in sorted order. I can't figure out where to stick the Sort-Object command