Skip to content

Commit

Permalink
Merge pull request #93 from Romanitho/fix
Browse files Browse the repository at this point in the history
Fix Microsoft.VCLibs.140.00.UWPDesktop detection
  • Loading branch information
Romanitho authored Oct 29, 2023
2 parents 1979ea0 + d8e82d9 commit 4318d09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion winget-detect.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Function Get-WingetCmd {
$winget = Get-WingetCmd

#Set json export file
$JsonFile = ".\InstalledApps.json"
$JsonFile = "$env:TEMP\InstalledApps.json"

#Get installed apps and version in json file
& $Winget export -o $JsonFile --accept-source-agreements | Out-Null
Expand Down
10 changes: 5 additions & 5 deletions winget-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ function Install-Prerequisites {

#Download and install
$SourceURL = "https://aka.ms/vs/17/release/VC_redist.$OSArch.exe"
$Installer = ".\VC_redist.$OSArch.exe"
$Installer = "$env:TEMP\VC_redist.$OSArch.exe"
Write-ToLog "-> Downloading $SourceURL..."
Invoke-WebRequest $SourceURL -UseBasicParsing -OutFile $Installer
Write-ToLog "-> Installing VC_redist.$OSArch.exe..."
Start-Process -FilePath $Installer -Args "/quiet /norestart" -Wait
Start-Process -FilePath $Installer -Args "/passive /norestart" -Wait
Start-Sleep 3
Remove-Item $Installer -ErrorAction Ignore
Write-ToLog "-> MS Visual C++ 2015-2022 installed successfully." "Green"
Expand All @@ -158,10 +158,10 @@ function Install-Prerequisites {
}

#Check if Microsoft.VCLibs.140.00.UWPDesktop is installed
if (!(Get-AppxPackage -Name 'Microsoft.VCLibs.140.00.UWPDesktop')) {
if (!(Get-AppxPackage -Name 'Microsoft.VCLibs.140.00.UWPDesktop' -AllUsers)) {
Write-ToLog "Microsoft.VCLibs.140.00.UWPDesktop is not installed" "Red"
$VCLibsUrl = "https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx"
$VCLibsFile = ".\Microsoft.VCLibs.x64.14.00.Desktop.appx"
$VCLibsFile = "$env:TEMP\Microsoft.VCLibs.x64.14.00.Desktop.appx"
Write-ToLog "-> Downloading $VCLibsUrl..."
Invoke-RestMethod -Uri $VCLibsUrl -OutFile $VCLibsFile
try {
Expand Down Expand Up @@ -199,7 +199,7 @@ function Install-Prerequisites {

Write-ToLog "-> Downloading Winget v$WinGetAvailableVersion"
$WingetURL = "https://github.com/microsoft/winget-cli/releases/download/v$WinGetAvailableVersion/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
$WingetInstaller = ".\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
$WingetInstaller = "$env:TEMP\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
Invoke-RestMethod -Uri $WingetURL -OutFile $WingetInstaller
try {
Write-ToLog "-> Installing Winget v$WinGetAvailableVersion"
Expand Down

0 comments on commit 4318d09

Please sign in to comment.