foreach ($clsid in $providers) if (Test-Path $clsid) return $true
Write-Host "Access Database Engine not found. Starting download..." -ForegroundColor Yellow try $webClient = New-Object System.Net.WebClient $webClient.DownloadFile($downloadUrl, $tempPath) Write-Host "Download completed: $tempPath" -ForegroundColor Green
Write-Host "Installing Access Database Engine silently (this may take a minute)..." -ForegroundColor Yellow
finally # Cleanup: remove downloaded installer if (Test-Path $tempPath) Remove-Item $tempPath -Force Write-Host "Cleaned up temporary installer." -ForegroundColor Gray
return $false Write-Host "Checking if Access Database Engine is already installed..." -ForegroundColor Cyan if (Test-ACEDriverInstalled) Write-Host "Access Database Engine appears to be already installed. Skipping installation." -ForegroundColor Green exit 0
powershell -ExecutionPolicy Bypass -File "Install-AccessDatabaseEngine.ps1"
# 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" )
catch Write-Host "Installation error: $_" -ForegroundColor Red exit 1
foreach ($clsid in $providers) if (Test-Path $clsid) return $true
Write-Host "Access Database Engine not found. Starting download..." -ForegroundColor Yellow try $webClient = New-Object System.Net.WebClient $webClient.DownloadFile($downloadUrl, $tempPath) Write-Host "Download completed: $tempPath" -ForegroundColor Green
Write-Host "Installing Access Database Engine silently (this may take a minute)..." -ForegroundColor Yellow
finally # Cleanup: remove downloaded installer if (Test-Path $tempPath) Remove-Item $tempPath -Force Write-Host "Cleaned up temporary installer." -ForegroundColor Gray
return $false Write-Host "Checking if Access Database Engine is already installed..." -ForegroundColor Cyan if (Test-ACEDriverInstalled) Write-Host "Access Database Engine appears to be already installed. Skipping installation." -ForegroundColor Green exit 0
powershell -ExecutionPolicy Bypass -File "Install-AccessDatabaseEngine.ps1"
# 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" )
catch Write-Host "Installation error: $_" -ForegroundColor Red exit 1