# 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" )
if ($process.ExitCode -eq 0) Out-File -FilePath $logFile -Append
finally # Cleanup: remove downloaded installer if (Test-Path $tempPath) Remove-Item $tempPath -Force Write-Host "Cleaned up temporary installer." -ForegroundColor Gray
If you need to run this in an , you can invoke it from cmd like this:
powershell -ExecutionPolicy Bypass -File "Install-AccessDatabaseEngine.ps1"
foreach ($path in $checkPaths) if (Test-Path $path) $acePath = (Get-ItemProperty -Path $path -Name "ACE" -ErrorAction SilentlyContinue).ACE if ($acePath -and (Test-Path $acePath)) return $true
foreach ($clsid in $providers) if (Test-Path $clsid) return $true