Microsoft Store: update all apps from the command-line
Posted by jpluimers on 2023/09/12
TL;DR
I have converted the below PowerShell one-liner into this batch file (the ^| syntax is to ensure the pipe runs within PowerShell, not within the batch file):
PowerShell 'Get-CimInstance -Namespace "Root\cimv2\mdm\dmmap" -ClassName "MDM_EnterpriseModernAppManagement_AppManagement01" ^| Invoke-CimMethod -MethodName UpdateScanMethod'
The why and how
Since I am a CLI person, and some Windows applications are only available on the Microsoft Store, I wanted to be able to initiate an update cycle from the command-line interface.
So I searched for [Wayback/Archive] microsoft store update all apps from the command-line – Google Search and found these to be valuable:
- [Wayback/Archive] Reddit: Command-line option for updating Microsoft Store apps? : sysadmin having a 4-line PowerShell script:
$namespaceName = "root\cimv2\mdm\dmmap" $className = "MDM_EnterpriseModernAppManagement_AppManagement01" $wmiObj = Get-WmiObject -Namespace $namespaceName -Class $className $result = $wmiObj.UpdateScanMethod() - [Wayback/Archive] How to force update of Windows Store Apps without launching the Store App? having the above, but also having this PowerShell one-liner using
Get-CimInstancewhich I like more:
Get-CimInstance -Namespace "Root\cimv2\mdm\dmmap" -ClassName "MDM_EnterpriseModernAppManagement_AppManagement01" | Invoke-CimMethod -MethodName UpdateScanMethod - [Wayback/Archive] Reddit: Can Windows be told to “Get Updates” for Microsoft Store apps on a schedule or on demand? Without needing to sign in to the device and manually open the Store? : sysadmin shows the Get-CimInstance solution also as a PowerShell 4-liner (which I reworked to use variable names):
$NameSpace = "Root\cimv2\mdm\dmmap" $ClassName = "MDM_EnterpriseModernAppManagement_AppManagement01" $CimInstance = Get-CimInstance -Namespace $NameSpace -ClassName $ClassName $Results = $CimInstance | Invoke-CimMethod -MethodName UpdateScanMethod
Methods used in the above code snippets:
- [Wayback/Archive] Get-CimInstance (CimCmdlets) – PowerShell | Microsoft Docs
The
Get-CimInstancecmdlet gets the CIM instances of a class from a CIM server. You can specify either the class name or a query for this cmdlet. This cmdlet returns one or more CIM instance objects representing a snapshot of the CIM instances present on the CIM server. - [Wayback/Archive] Invoke-CimMethod (CimCmdlets) – PowerShell | Microsoft Docs
The
Invoke-CimMethodcmdlet invokes a method of a CIM class or CIM instance using the name-value pairs specified by the Arguments parameter. - [Wayback/Archive] Get-WmiObject (Microsoft.PowerShell.Management) – PowerShell | Microsoft Docs
Starting in PowerShell 3.0, this cmdlet has been superseded by
Get-CimInstance.
Searching with [Wayback/Archive] MDM_EnterpriseModernAppManagement_AppManagement01 UpdateScanMethod – Google Search, I found the method is in the documentation but lacks details:
- [Wayback/Archive] UpdateScanMethod method of the MDM_EnterpriseModernAppManagement_AppManagement01 class – Win32 apps | Microsoft Docs
[Some information relates to pre-released product which may be substantially modified before it’s commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.]
Method for starting the Windows Update scan. See also, [Wayback/Archive] UpdateScan.
The last link actually refers to the below class which contains an
UpdateScanmethod. - [Wayback/Archive] EnterpriseModernAppManagement CSP – Windows Client Management | Microsoft Docs
AppManagement/UpdateScan
Required. Used to start the Windows Update scan.
Related
These previous blog posts are related:
- Installing the Microsoft Store version of Windows Terminal via the winget command-line
- Different ways for installing Windows features on the command line – Peter Hahndorf
–jeroen






Leave a comment