diff --git a/scripts/config_test_vm.psm1 b/scripts/config_test_vm.psm1 index 891ae50ca5..b48460a976 100644 --- a/scripts/config_test_vm.psm1 +++ b/scripts/config_test_vm.psm1 @@ -230,6 +230,7 @@ function Install-eBPFComponentsOnVM [Parameter(Mandatory=$true)] [bool] $KmTracing, [Parameter(Mandatory=$true)] [string] $KmTraceType) $WorkingDirectory = "$env:SystemDrive\$WorkingDirectory" + Write-Host "Working Directory: $WorkingDirectory" Import-Module $WorkingDirectory\common.psm1 -ArgumentList ($LogFileName) -Force -WarningAction SilentlyContinue Import-Module $WorkingDirectory\install_ebpf.psm1 -ArgumentList ($WorkingDirectory, $LogFileName) -Force -WarningAction SilentlyContinue diff --git a/scripts/install_ebpf.psm1 b/scripts/install_ebpf.psm1 index 322fb6d81b..648a1adddd 100644 --- a/scripts/install_ebpf.psm1 +++ b/scripts/install_ebpf.psm1 @@ -95,18 +95,15 @@ function Install-eBPFComponents # Install the Visual C++ Redistributable. try { Write-Host "Installing Visual C++ Redistributable from '$VcRedistPath'..." - if (-not (Test-Path $VcRedistPath)) { - Write-Host "Visual C++ Redistributable not found at '$VcRedistPath'." - exit 1; - } - $process = Start-Process -FilePath $VcRedistPath -ArgumentList "/quiet", "/norestart" -Wait - if ($process.ExitCode -ne 0) { - Write-Host "Visual C++ Redistributable installation failed. Exit code: $($process.ExitCode)" - exit 1; + & "Path\To\VcRedist.exe" /quiet /norestart + $exitCode = $LASTEXITCODE + if ($exitCode -eq 0) { + Write-Host "Visual C++ Redistributable installation completed successfully." + } else { + Write-Host "Visual C++ Redistributable installation failed. Exit code: $exitCode" } } catch { - Write-Host "An error occurred while installing Visual C++ Redistributable: $_" - exit 1; + Write-Host "An exception occurred while installing Visual C++ Redistributable: $_" } Write-Host "Cleaning up..." Remove-Item $VcRedistPath -Force