Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems downloading the Microsoft Visual C++ Redistributables #171

Open
ibeerens opened this issue Oct 9, 2024 · 7 comments
Open

Problems downloading the Microsoft Visual C++ Redistributables #171

ibeerens opened this issue Oct 9, 2024 · 7 comments

Comments

@ibeerens
Copy link

ibeerens commented Oct 9, 2024

Expected Behavior

The Microsoft Visual C++ Redistributables are downloaded and installed.

Current Behavior

What is the current behavior?

Since today the the VC Redist downloading has gone wrong. The files are 0 KB.

image

This command cannot be run due to the error: %1 is not a valid Win32 application.
At line:15 char:5
+     throw $_.Exception.Message
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (This command ca...32 application.:String) [], RuntimeException
    + FullyQualifiedErrorId : This command cannot be run due to the error: %1 is not a valid Win32 application.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

Run this script:

[System.String] $Path = "$Env:SystemDrive\Apps\Microsoft\VcRedist"

#region Script logic
New-Item -Path $Path -ItemType "Directory" -Force -ErrorAction "SilentlyContinue" | Out-Null

# Run tasks/install apps
try {
    Write-Information -MessageData ":: Install Microsoft Visual C++ Redistributables" -InformationAction "Continue"
    Import-Module -Name "VcRedist" -Force
    sleep 10
    Get-VcList | Save-VcRedist -Path $Path | Install-VcRedist 
    # -Silent | Out-Null
}
catch {
    throw $_.Exception.Message
}
#endregion

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • VcRedist Version: Use Get-Module -ListAvailable VcRedist: 4.1.498
  • PowerShell Version: Use Get-PSVersion: 5.1
  • Operating System: Windows 10, 11 and Windows Server 2022

Failure Logs

Please include any relevant log snippets or files here.

@ibeerens
Copy link
Author

ibeerens commented Oct 9, 2024

Strange URLs

image

I can manually download both files from the URIs with the correct file size and install the redistributables.

image

@aaronparker
Copy link
Owner

Working OK here:
image

@sjeanjean
Copy link

Same problem but randomly (occurs mainly on week-end)

Code:

Write-Host (get-date -format 'yyyy/MM/dd HH:mm:ss') '================ Install VcRedist ========================'",
Install-Module -Name VcRedist",
Write-Host "Import-Module -Name VcRedist"
Import-Module -Name VcRedist
$Path = "$env:Temp\VcRedist"
Write-Host "Saving VcRedists to path: $Path."
New-Item -Path $Path -ItemType 'Directory' -Force -ErrorAction 'SilentlyContinue' > $null
$VerbosePreference = "Continue"
                
Write-Host "Downloading and installing supported Microsoft Visual C++ Redistributables."
$Redists = Get-VcList | Save-VcRedist -Path $Path | Install-VcRedist -Silent
Write-Host "Installed Visual C++ Redistributables:"
$Redists | Select-Object -Property 'Name', 'Release', 'Architecture', 'Version' -Unique

Output:

2024/10/13 02:51:18 ================ Install VcRedist ========================
Import-Module -Name VcRedist
Saving VcRedists to path: C:\Users\packer\AppData\Local\Temp\VcRedist.
Downloading and installing supported Microsoft Visual C++ Redistributables.
Start-Process : This command cannot be run due to the error: %1 is not a valid Win32 application.

At C:\Program Files\WindowsPowerShell\Modules\VcRedist\4.1.498\Public\Install-VcRedist.ps1:77 char:43
+                                 $Result = Start-Process @params
+                                           ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand


Provisioning step had errors: Running the cleanup provisioner, if present...

@aaronparker
Copy link
Owner

What's the environment you're running in? (i.e. on-prem, Azure etc.). Does this occur in more than one environment?
Any proxy servers/firewalls in the internet path?

@sjeanjean
Copy link

sjeanjean commented Oct 14, 2024 via email

@ibeerens
Copy link
Author

I think it is a problem in the Microsoft CDN network in West Europe. Besides the C++ VC redist, I have problems with the .NET and the M365 download sometimes. When I change the hosts file name to use another IP in the United States everything worked as aspected. As temp fix I created a script to to add this record 93.184.215.201 download.visualstudio.microsoft.com to the hosts file.. After the change, all the downloads are succesfull. The last step before sysprepping the image isI removing the record from the hosts file.

@aaronparker
Copy link
Owner

I have seen various HTTP 502 errors in the past when building images in Azure, typically in Australia East. I haven't been able to determine the cause yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants