-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAdobeReaderDefault.ps1
More file actions
30 lines (26 loc) · 1.19 KB
/
AdobeReaderDefault.ps1
File metadata and controls
30 lines (26 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Sets Adobe Reader as the default PDF viewer. Not really tested.
# Written by Jonathan Bullock
# Not sure when I wrote it. Sometime 2021?
#
#
# Ensure script is being run as an administrator
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Write-Warning "You do not have Administrator rights to run this script!`nPlease re-run this script as an Administrator!"
Break
}
$adobeExePath = "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" # Replace this with your Adobe Reader path
# Check if Adobe Reader exists
If (!(Test-Path -Path $adobeExePath)) {
Write-Warning "Adobe Reader does not exist at $adobeExePath`nPlease update the path to the Adobe Reader executable!"
Break
}
# Set Adobe Reader as the default PDF viewer
Try {
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\UserChoice" -Name "ProgId" -Value "AcroExch.Document.DC" -ErrorAction Stop
}
Catch {
Write-Warning "Could not set Adobe Reader as the default PDF viewer!"
Break
}
Write-Output "Successfully set Adobe Reader as the default PDF viewer!"