catch Write-Host "Download failed: $_" -ForegroundColor Red exit 1 /quiet - no UI, /passive - shows progress (change to /quiet for total silence) $installArgs = "/quiet /norestart"
foreach ($clsid in $providers) if (Test-Path $clsid) return $true accessdatabaseengine_x64.exe
# Alternative: check for ACE OLEDB provider in registry $providers = @( "HKLM:\SOFTWARE\Classes\CLSID\3BE786A0-0366-4F5C-8FB6-95A30E2BDB44" # ACE 12.0 "HKLM:\SOFTWARE\Classes\CLSID\3BE786A0-0366-4F5C-8FB6-95A30E2BDB45" # ACE 16.0 (2016) "HKLM:\SOFTWARE\WOW6432Node\Classes\CLSID\3BE786A0-0366-4F5C-8FB6-95A30E2BDB44" "HKLM:\SOFTWARE\WOW6432Node\Classes\CLSID\3BE786A0-0366-4F5C-8FB6-95A30E2BDB45" ) accessdatabaseengine_x64.exe
if ($process.ExitCode -eq 0) Write-Host "Installation completed successfully." -ForegroundColor Green # Optional: log the installation "$(Get-Date) - Installation successful" else Out-File -FilePath $logFile -Append exit $process.ExitCode accessdatabaseengine_x64.exe
Write-Host "Installing Access Database Engine silently (this may take a minute)..." -ForegroundColor Yellow
catch Write-Host "Installation error: $_" -ForegroundColor Red exit 1