vcredist icon indicating copy to clipboard operation
vcredist copied to clipboard

Problems downloading the Microsoft Visual C++ Redistributables

Open ibeerens opened this issue 1 year ago • 7 comments

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 avatar Oct 09 '24 14:10 ibeerens

Strange URLs

image

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

image

ibeerens avatar Oct 09 '24 14:10 ibeerens

Working OK here: image

aaronparker avatar Oct 09 '24 21:10 aaronparker

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...

sjeanjean avatar Oct 14 '24 06:10 sjeanjean

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?

aaronparker avatar Oct 14 '24 11:10 aaronparker

Hello,

The image build is done on Azure, with Azure Image Builder. The base image is win10-22h2-avd-g2

The connection to internet is proxyfied by a container build by AIB. https://learn.microsoft.com/en-us/azure/virtual-machines/security-isolated-image-builds-image-builder#dont-bring-your-own-build-vm-subnet

Best regards, Stéphane JEANJEAN

De : Aaron Parker @.> Envoyé : lundi 14 octobre 2024 13:05 À : aaronparker/vcredist @.> Cc : JEANJEAN, Stéphane @.>; Comment @.> Objet : Re: [aaronparker/vcredist] Problems downloading the Microsoft Visual C++ Redistributables (Issue #171)

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?

— Reply to this email directly, view it on GitHubhttps://secure-web.cisco.com/1gRUjQhC0wfM7gjdxw6YEEW9RRKYwoqbf1IkzfTeJ7AYygiLEpC7bjNQBpl6qvP4J9seNyehzHY3IZPlIOBZEh7r6zLBHNYQ8F-hbXCihz0aarSDIIsytvvOE-tCHPAuiIxFDqob9O799SsF3m9xcbkjTHGsXMQFCXCjo-3Zq7gfLP6AyRQf0dHYEgx2BR1nID1uV0k91MykBbrAqWYTzfgldMrTOV_ddM8wBN2daMxnCPQ9vGJnBfnikMOH7y9nJmTiSj2j-YyW7mQv1y8xwLE0Epe55vDX98m0aXMmjtT_R_AIQFAqE2attvDtxGohqc3p7o0o37rAuB8WPtHL85v-wz8UxJiITYx3cZea37B5VC53Ix4omE3SDisiJPTocg9Ytgs5WoNPFHX7UU6c27sPPm1swL8eRrC17ocfr9bO76IY_YVFqBqiItcxdnV1y/https%3A%2F%2Fgithub.com%2Faaronparker%2Fvcredist%2Fissues%2F171%23issuecomment-2410877424, or unsubscribehttps://secure-web.cisco.com/1ZWkuFQui38uwAb28FJQhN1fG0B027MauobrnQ0yBIK551B8gYomjME-YrLXh0hjuctyIdzFfP8oJNZblOpLJXi3io3JyodhrmozE1hzYOLmI9aUAU-HSI_DbYNZOsiyQzJGamd1gWatHDWYP8RUuq4OpJV0G37eZGRq6eHLZQfz1t43CHEa0N-eCXsVg-aYPhZNuIgyl8QJoAlkIJLIGgA8ZjW4jw_C8L5f4TvxiMX2Ex6wtX9JaPQQnPop04MGboJ4mTK1LfRhSwYDzRIE8vMcVaED2DTxDYJrDKQGCUhdVPMVx9gPBEJxy_zPZLuPYtVIF5u5rZvYt-g9-a7pc0bSoB3KvOSF4o-yKS5qKsdDBTLsuQ6IvncVFp9Klliwz5iSlQSy7WPx3EYzUoFNUAx6vrq6SEz7lyMW3BatPWyCS5sc2dNSFPufy8yLRnMo1/https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAHHIUDDCMEM3PYEZV4RVAODZ3OQPNAVCNFSM6AAAAABPUVGTTCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJQHA3TONBSGQ. You are receiving this because you commented.Message ID: @.@.>>

Les donnees et renseignements contenus dans ce message sont personnels, confidentiels et secrets. Toute publication, utilisation ou diffusion, meme partielle, doit etre autorisee. Si vous n'etes pas le bon destinataire, nous vous demandons de ne pas lire, copier, utiliser ou divulguer cette communication. Nous vous prions de notifier cette erreur a l'expediteur et d'effacer immediatement cette communication de votre systeme.

Any data and information contained in this electronic mail is personal, confidential and secret. Any total or partial publication, use or distribution must be authorized. If you are not the right addressee, we ask you not to read, copy, use or disclose this communication. Please notify this error to the sender and erase at once this communication from your system.

sjeanjean avatar Oct 14 '24 12:10 sjeanjean

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.

ibeerens avatar Oct 14 '24 18:10 ibeerens

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.

aaronparker avatar Oct 14 '24 21:10 aaronparker