Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

Use PowerShell to Inventory Modern Apps in Windows 8

$
0
0

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell to look at modern apps in Windows 8.

Microsoft Scripting Guy, Ed Wilson, is here. One of the things I love about Windows 8 (including my Surface RT) are the modern apps. They are, well, just so modern. Of course, what I really like about them are the Windows PowerShell cmdlets that are part of the Appx module. Here are the cmdlets and functions from that module:

PS C:\> Get-Command -Module appx

 

CommandType     Name                                               ModuleName

-----------     ----                                               ----------

Function        Get-AppxLastError                                  Appx

Function        Get-AppxLog                                        Appx

Cmdlet          Add-AppxPackage                                    Appx

Cmdlet          Get-AppxPackage                                    Appx

Cmdlet          Get-AppxPackageManifest                            Appx

Cmdlet          Remove-AppxPackage                                 Appx

Using Get-AppxPackage

I can use the Get-AppxPackage cmdlet to view application packages for my current user ID. But If I want to view packages from all users, I need to start Windows PowerShell with Admin rights. To see all of the modern apps that are installed for my sign-in ID, I use the Get-AppxPackage cmdlet with no parameters. An example of this is shown here:

Image of command output

Because the cmdlet displays packages for my current sign-in ID, the output does not include user information by default. When I use the –AllUsers switch, PackageUserInformation becomes available, as shown here:

Get-AppxPackage –AllUsers

The command and the associated output are shown in the image that follows.

Image of command output

I can also specify a particular user. This user can be from the domain (if the computer is domain-joined), or it can be from the local account database. In the following example, I choose a user from the local account database. The syntax is computername\username.

Get-AppxPackage -User edlt\ed

Note  Like when I use the cmdlet to retrieve current sign-in user information, PackageUserInformation does not display by default when retrieving specific user information.

The cool thing is that with Windows PowerShell, I can also sort by group and do any parsing that I feel I should do. For example, I might want to see how many different users installed modern applications on this computer. I do this by using the –Unique switch in conjunction with the Select-Object cmdlet as follows:

Get-AppxPackage -AllUsers | select packageuserinformation –Unique

The command and its associated output are shown here:

Image of command output

It also appears that I have several packages that are already downloaded, but not yet installed. I see this by looking at "Unknown user: Staged.” So I query for all users, and I select the name and version of the product when the user contains the word "staged." Here is the command and the associated output:

PS C:\> Get-AppxPackage -AllUsers | where packageuserinformation -match staged |

select name, version

 

Name                                       Version

----                                       -------

5269FriedChicken.YouTubeVideosDownloader   1.0.0.132

24264Craftbox.Showtime                     6.0.0.19

LenovoCorporation.LenovoSettings           1.2.0.13723

PixelTuckerPtyLtd.MetroTwit                1.0.0.126

PixelTuckerPtyLtd.MetroTwit                1.0.0.127

Because I see there are two copies of MetroTwit staged, I decide to look at information concerning my version of MetroTwit. To do this, I use the –Name parameter as shown here:

PS C:\> Get-AppxPackage -Name *metrotwit*

 

Name              : PixelTuckerPtyLtd.MetroTwit

Publisher         : CN=34979D06-CC5C-48B5-BB2F-8EF70E1A425E

Architecture      : Neutral

ResourceId        :

Version           : 1.0.0.116

PackageFullName   : PixelTuckerPtyLtd.MetroTwit_1.0.0.116_neutral__5kbmb3e034y6r

InstallLocation   : C:\Program Files\WindowsApps\PixelTuckerPtyLtd.MetroTwit_1.0.0.1

                    16_neutral__5kbmb3e034y6r

IsFramework       : False

PackageFamilyName : PixelTuckerPtyLtd.MetroTwit_5kbmb3e034y6r

PublisherId       : 5kbmb3e034y6r

Cool. I see that I am using an older version of MetroTwit. I already have two updated versions on my system, and I simply need to upgrade the package.

Well, that is all there is to exploring Appx packages with Windows PowerShell. Join me tomorrow when I will talk about more cool Windows PowerShell stuff.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>