Search updates using the Windows Store

You may have noticed that the ‘Windows Store’ informs us how many Modern UI Apps have to be updated
Modern UI Windows Store
Windows Store updates
Note at this step that ‘Fruit Ninja’ requires an update.

Windows 8 has a nice built-in Get-AppxPackage cmdlet that lists the app packages (.appx) that are either installed in a user profile or for all user accounts on the computer.

First let me quickly present what can be done with these cmdlets

# List all the Windows Store application for the current user            
Get-AppxPackage | select Name,Version            
# List all the commands available in the new Appx module            
Get-Command -Module Appx            
# List applications for all users            
Get-AppxPackage -AllUsers |             
Select Name,Version,PackageUserInformation |             
Format-Table -Property Name,Version,            

Now, let’s take our specific example: Fruit Ninja.
We can see for the current profile that its installed version is:

Get-AppxPackage | Where Name -match "fruit"

Fruit Ninja before update

How did the Windows store know that my installed version of Fruit Ninja needs an update ?
The answer can actually be found in the WindowsUpdate.log located in C:\windows
Windows Update log
Notice the CallerID, the ServiceID and the scope.

Now, let’s examine the COM object named Microsoft.Update.ServiceManager

(New-Object -ComObject Microsoft.Update.ServiceManager).            
Services | Select Name,ServiceID | ft -AutoSize

Microsoft Update service providers
It reveals that there’s a new update service provider named ‘Windows Store’ that has for serviceID: 117cab2d-82b1-4b5a-a08c-4d62dbee7782

Now the last piece of the puzzle is the ‘SearchScope’. Fortunately, the following MSDN page,, has the answer:

Finally, the following code demonstrates how to evaluate how many Appx (Modern UI applications) require an update:

$Session = New-Object -ComObject Microsoft.Update.Session            
$Searcher = $Session.CreateUpdateSearcher()            
$Searcher.ServiceID = '117CAB2D-82B1-4B5A-A08C-4D62DBEE7782'            
$Searcher.SearchScope = 2            
$Searcher.ServerSelection = 3            
$Searcher.Online = $false            
$Criteria = "IsInstalled=0 and DeploymentAction='Installation' or 
IsPresent=1 and DeploymentAction='Uninstallation' or 
IsInstalled=1 and DeploymentAction='Installation' and
RebootRequired=1 or IsInstalled=0 and 
DeploymentAction='Uninstallation' and RebootRequired=1"            
$SearchResult = $Searcher.Search($Criteria)            
$total = $SearchResult.Updates.Count            
'{0} Appx packages require Windows Store update' -f $total            
$SearchResult.Updates | Where Title -match "Fruit" |            
Select Title,IsHidden,KBArticleIDs,IsDownloaded,IsMandatory,            
LastDeploymentChangeTime |            
Sort-Object -Property LastDeploymentChangeTime |            
Format-Table -Wrap -Property Title,            
@{l='Size(M)';e={'{0:N2}' -f ($_.MaxDownloadSize/1MB)}},            
} -AutoSize

WSupdate results


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.