From aa6d2e789f960370e24990bbe010c55b2d73c2ac Mon Sep 17 00:00:00 2001 From: Gabe Date: Wed, 6 Aug 2025 23:47:30 +0000 Subject: [PATCH] Upload files to "App Uninstall Scripts" --- ... - Phish Alert Button(PAB) - Uninstall.ps1 | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 App Uninstall Scripts/App - Phish Alert Button(PAB) - Uninstall.ps1 diff --git a/App Uninstall Scripts/App - Phish Alert Button(PAB) - Uninstall.ps1 b/App Uninstall Scripts/App - Phish Alert Button(PAB) - Uninstall.ps1 new file mode 100644 index 0000000..a4ac320 --- /dev/null +++ b/App Uninstall Scripts/App - Phish Alert Button(PAB) - Uninstall.ps1 @@ -0,0 +1,56 @@ +<# +Author: Gabe Kerntke +Date: 04-12-2024 + +.Synopsis +Script checks to see if the Phish Alert Button(PAB) is installed, if installed it will uninstall + +.Modified +2024-04-11 (GabeK) - Original script created + +#> + +###################### +### Variables ### +###################### +$Name = "Phish Alert" + +###################### +### 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 via WMIobject (control panel) +Function Uninstall { + $Uninstall = Get-WmiObject Win32_Product -filter "name like '%$Name%'" | ForEach-Object { $_.Uninstall() } + $Value = $Uninstall | Select-Object -ExpandProperty ReturnValue + + If ($Value -eq "0") { + Write-Host "$Name uninstalled successfully" + } + else { + Write-Host "$Name failed to uninstall" + } +} + +###################### +### 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" +} \ No newline at end of file