-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathUninstall-AdobeReaderDC-Choco.ps1
More file actions
33 lines (28 loc) · 1.11 KB
/
Uninstall-AdobeReaderDC-Choco.ps1
File metadata and controls
33 lines (28 loc) · 1.11 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
31
32
33
$ChocoPackage = "adobereader"
# Check if Chocolatey is installed and if not, install it.
If ( get-command -Name choco.exe -ErrorAction SilentlyContinue ){
$ChocoExe = "choco.exe"
} elseif (test-path -Path (Join-Path -path $Env:ALLUSERSPROFILE -ChildPath "Chocolatey\bin\choco.exe")) {
$ChocoExe = Join-Path -path $Env:ALLUSERSPROFILE -ChildPath "Chocolatey\bin\choco.exe"
} else {
try {
write-output "Starting to install chocolatey...."
Invoke-Expression ((New-Object -TypeName net.webclient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop
choco feature enable -n allowGlobalConfirmation
$ChocoExe = Join-Path -path $Env:ALLUSERSPROFILE -ChildPath "Chocolatey\bin\choco.exe"
}
catch {
Throw "Failed to install Chocolatey"
}
}
If ($ChocoExe){
try{
start-process -FilePath $ChocoExe -ArgumentList "uninstall $ChocoPackage --confirm --all-versions" -Wait
} Catch {
throw "Could not uninstall $ChocoPackage"
Exit 667
}
} else {
throw 'Could not find choco.exe'
Exit 666
}