[CmdNotFound] Update InstallWinGetClientModule script to update to latest version of WinGet.Client module if not at minimum version

This commit is contained in:
Jeremy Sinclair 2024-05-01 12:09:27 -04:00
parent 034308b976
commit 464c309976

View File

@ -1,8 +1,12 @@
if (Get-Module -ListAvailable -Name Microsoft.WinGet.Client)
{
Write-Host "WinGet Client module detected."
# This message will be compared against in Command Not Found Settings page code behind. Take care when changing it.
}
$wingetModule = Get-Module -ListAvailable -Name Microsoft.WinGet.Client
if ($wingetModule) {
if ($wingetModule.Version -ge "1.8.1133") {
Write-Host "WinGet Client module detected."
# This message will be compared against in Command Not Found Settings page code behind. Take care when changing it.
} else {
Upgrade-Module -Name Microsoft.WinGet.Client
}
}
else {
Install-Module -Name Microsoft.WinGet.Client
if (Get-Module -ListAvailable -Name Microsoft.WinGet.Client)