Upload files to "App Uninstall Scripts"
This commit is contained in:
@@ -0,0 +1,58 @@
|
|||||||
|
<#
|
||||||
|
Author: Gabe Kerntke
|
||||||
|
Date: 07-15-2024
|
||||||
|
|
||||||
|
.Synopsis
|
||||||
|
Script checks to see if ZixSelect for Outlook is installed, if installed it will uninstall
|
||||||
|
|
||||||
|
.Modified
|
||||||
|
2024-07-15 (GabeK) - Original script created
|
||||||
|
|
||||||
|
#>
|
||||||
|
|
||||||
|
######################
|
||||||
|
### Variables ###
|
||||||
|
######################
|
||||||
|
$Name = "ZixSelect"
|
||||||
|
|
||||||
|
######################
|
||||||
|
### Functions ###
|
||||||
|
######################
|
||||||
|
|
||||||
|
#Function checks for 32 or 64 bit processor and then pulls list of applications accordingly
|
||||||
|
Function Get-Software ($CPU = $ENV:PROCESSOR_ARCHITECTURE) {
|
||||||
|
If ($CPU -eq 'AMD64') {
|
||||||
|
$64bit = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*
|
||||||
|
$32bit = Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*
|
||||||
|
$32bit + $64bit
|
||||||
|
}
|
||||||
|
Else { Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* }
|
||||||
|
}
|
||||||
|
|
||||||
|
#Function to uninstall program via Registry UninstallString
|
||||||
|
Function Uninstall {
|
||||||
|
$Registry = $Applist | Select-Object -ExpandProperty UninstallString
|
||||||
|
$UninstallString = $Registry.Substring(0, $Registry.Length - 35)
|
||||||
|
$Command = $UninstallString += ' -x -s -f1"\\cb-domain.local\NETLOGON\Software\uninstall.iss"'
|
||||||
|
cmd /c $Command
|
||||||
|
Start-Sleep 120
|
||||||
|
If ($Applist.DisplayName -like "*$Name*") {
|
||||||
|
Write-Host "Failed to uninstall $Name"
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
Write-Host "$Name uninstalled successfully"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
######################
|
||||||
|
### Script start ###
|
||||||
|
######################
|
||||||
|
|
||||||
|
#Check to see if program is installed
|
||||||
|
$Applist = Get-Software | Where-Object { $_.DisplayName -like "*$Name*" }
|
||||||
|
If ($Applist.DisplayName -like "*$Name*") {
|
||||||
|
Uninstall
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
Write-Host "$Name is not installed, exiting script"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user