(Seems only works with Windows 11)
Now winget supports to install a Microsoft store app. First, you need to get the store app Id.
Go to the Microsoft official website: https://www.microsoft.com/en-US/
And search the store app here. For example:
Click it. And now you have the address.
So, for example, the 'to do app' has ID: 9nblggh5r558
You can use the command to open a store page:
ms-windows-store://pdp/?ProductId=9nblggh5r558
Put the Product ID on the last.
You can also build a PowerShell to start the store automatically:
Start-Process "ms-windows-store://pdp/?ProductId=9nblggh5r558"
That will lead the user to the store page.
But what if you want to install this app without a prompt?
First, install winget with the following script:
# Install Winget
if (-not $(Get-Command winget)) {
Write-Host "Installing WinGet..." -ForegroundColor Green
Start-Process "ms-appinstaller:?source=https://aka.ms/getwinget"
while(-not $(Get-Command winget))
{
Write-Host "Winget is still not found!" -ForegroundColor Yellow
Start-Sleep -Seconds 5
}
}
When you have winget installed and the app Id, you can run this to install it locally:
$storeAppId = "9NBLGGH5R558" # This is your store app ID.
winget install --id $storeAppId --exact --source msstore --accept-package-agreements --accept-source-agreements
That's all. It's installed!
If you are a developer building an automation
If you are building a script that tries to install an app when it is not installed, you need to get the exact winget app Name.
Copy the winget app name. Like here, it's "Microsoft To Do".
Then you can use the following script directly.
Even easier
function Install-StoreApp {
param (
[string]$storeAppId,
[string]$wingetAppName
)
# Install Winget
if (-not $(Get-Command winget)) {
Write-Host "Installing WinGet..." -ForegroundColor Green
Start-Process "ms-appinstaller:?source=https://aka.ms/getwinget"
while(-not $(Get-Command winget))
{
Write-Host "Winget is still not found!" -ForegroundColor Yellow
Start-Sleep -Seconds 5
}
}
if ("$(winget list --name $wingetAppName --exact --source msstore)".Contains("--")) {
Write-Host "$wingetAppName is already installed!" -ForegroundColor Green
}
else {
Write-Host "Attempting to download $wingetAppName..." -ForegroundColor Green
winget install --id $storeAppId.ToUpper() --name $wingetAppName --exact --source msstore --accept-package-agreements --accept-source-agreements
}
}
Examples
Install-StoreApp -storeAppId "9NBLGGH5R558" -wingetAppName "Microsoft To Do"
Install-StoreApp -storeAppId "9MV0B5HZVK9Z" -wingetAppName "Xbox"
Install-StoreApp -storeAppId "9wzdncrfjbh4" -wingetAppName "Microsoft Photos"
Install-StoreApp -storeAppId "9nblggh4qghw" -wingetAppName "Microsoft Sticky Notes"
Install-StoreApp -storeAppId "9wzdncrfhvqm" -wingetAppName "Mail and Calendar"
Install-StoreApp -storeAppId "9ncbcszsjrsb" -wingetAppName "Spotify Music"
This blog post provides a detailed guide on how to install Windows Store apps using WinGet, a package manager for Windows. The author explains the process step by step, starting with finding the app's ID from the Microsoft official website, and then using WinGet to install the app locally. The blog also includes tips for developers who want to automate this process, as well as an even easier method using a PowerShell function.
The core idea of this blog post is to provide an alternative and efficient way to install Windows Store apps using WinGet, which can be especially useful for developers and people who want to automate the installation process. This is a great idea, as it can save time and effort compared to manually installing apps through the Microsoft Store.
One of the major highlights of the post is the clear and detailed explanation of each step, accompanied by images. This makes it easy for readers to follow along and understand the process. The provided PowerShell scripts and function are also a great addition, as they make it even more convenient to install apps using WinGet.
However, it is important to note that the blog post mentions that this method seems to only work with Windows 11. It would be helpful if the author could provide more information on the compatibility with other Windows versions or clarify if this method is exclusive to Windows 11.
In conclusion, this blog post offers a valuable alternative to installing Windows Store apps using WinGet, with detailed instructions and scripts to make the process even more efficient. The author has done a great job explaining the process and providing useful tools. It would be beneficial to clarify the compatibility with different Windows versions to ensure that all readers can take advantage of this method.
thans andunin