# Script to set Adobe Acrobat as default for specified file types $fileTypes = @(".pdf") $setUserFtaPath = "C:\Scripts\Software\setuserfta.exe" # Function to check and set default app for a file type function Set-DefaultAppIfNeeded { param( [string]$fileType ) try { # Get the current default app for the file type $currentDefault = (Get-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\$fileType\UserChoice" -ErrorAction SilentlyContinue).ProgId # Check if Adobe Acrobat is not the default if ($currentDefault -ne "AcroExch.Document") { Write-Host "Setting Adobe Acrobat as default for $fileType" # Ensure setuserfta.exe path exists if (-not (Test-Path $setUserFtaPath)) { Write-Error "setuserfta.exe not found at $setUserFtaPath" return } # Run setuserfta.exe to set Adobe Acrobat as default Start-Process $setUserFtaPath -ArgumentList "`"$fileType`" AcroExch.Document" -Wait -NoNewWindow } else { Write-Host "Adobe Acrobat is already the default for $fileType" } } catch { Write-Error "Error processing $fileType`: $_" } } # Process each file type foreach ($type in $fileTypes) { Set-DefaultAppIfNeeded -fileType $type } Write-Host "File type default app check completed."