@@ -181,16 +181,17 @@ Function Confirm-RSWinGet {
181181 # Checking if the installed version of WinGet are the same as the latest version of WinGet
182182 [version ]$vWinGet = [string ]$SysInfo.WinGet
183183 [version ]$vGitHub = [string ]$GitHubInfo.Tag
184+ if ($WinGet -ne " 1.19.3531.0" ) {
185+ if ([Version ]$vWinGet -lt [Version ]$vGitHub ) {
186+ Write-Output " WinGet has a newer version $ ( $GitHubInfo.Tag ) , downloading and installing it..."
187+ Invoke-WebRequest - UseBasicParsing - Uri $GitHubInfo.DownloadUrl - OutFile $GitHubInfo.OutFile
184188
185- if ([Version ]$vWinGet -lt [Version ]$vGitHub -or $WinGet -like " 1.19.3531.0" ) {
186- Write-Output " WinGet has a newer version $ ( $GitHubInfo.Tag ) , downloading and installing it..."
187- Invoke-WebRequest - UseBasicParsing - Uri $GitHubInfo.DownloadUrl - OutFile $GitHubInfo.OutFile
188-
189- Write-Output " Installing version $ ( $GitHubInfo.Tag ) of WinGet..."
190- Add-AppxPackage $ ($GitHubInfo.OutFile )
191- }
192- else {
193- Write-OutPut " Your already on the latest version of WinGet $ ( $WinGet ) , no need to update."
189+ Write-Output " Installing version $ ( $GitHubInfo.Tag ) of WinGet..."
190+ Add-AppxPackage $ ($GitHubInfo.OutFile )
191+ }
192+ else {
193+ Write-OutPut " Your already on the latest version of WinGet $ ( $WinGet ) , no need to update."
194+ }
194195 }
195196}
196197Function Get-RSInstallInfo {
@@ -249,7 +250,7 @@ Function Get-RSInstallInfo {
249250 # Collects everything in pscustomobject to get easier access to the information
250251 [System.Object ]$SysInfo = [PSCustomObject ]@ {
251252 VCLibs = $ (Get-AppxPackage - Name " Microsoft.VCLibs.140.00" - AllUsers | Where-Object { $_.Architecture -eq $Arch })
252- WinGet = $ (try { (Get-AppxPackage - AllUsers | Where-Object { $_.name -like " Microsoft.DesktopAppInstaller " } | Sort-Object { $_.Version -as [version ] } - Descending | Select-Object Version - First 1 ).version } catch { " 0.0.0.0" })
253+ WinGet = $ (try { (Get-AppxPackage - AllUsers | Where-Object { $_.PackageFamilyName -like " Microsoft.DesktopAppInstaller_8wekyb3d8bbwe " } | Sort-Object { $_.Version -as [version ] } - Descending | Select-Object Version - First 1 ).version } catch { " 0.0.0.0" })
253254 VisualCRedistUrl = $VisualCRedistUrl
254255 VCLibsUrl = $VCLibsUrl
255256 Arch = $Arch
0 commit comments