From 705c279a8979a6a28154a2c4856882d0f252fc4d Mon Sep 17 00:00:00 2001 From: Gabe Date: Wed, 6 Aug 2025 23:53:54 +0000 Subject: [PATCH] Upload files to "App Uninstall Scripts" --- .../App - Arcserve UDP Agent - Uninstall.ps1 | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 App Uninstall Scripts/App - Arcserve UDP Agent - Uninstall.ps1 diff --git a/App Uninstall Scripts/App - Arcserve UDP Agent - Uninstall.ps1 b/App Uninstall Scripts/App - Arcserve UDP Agent - Uninstall.ps1 new file mode 100644 index 0000000..40b5747 --- /dev/null +++ b/App Uninstall Scripts/App - Arcserve UDP Agent - Uninstall.ps1 @@ -0,0 +1,84 @@ +<# +Author: Craig Krautkramer +Date: 07/10/22 + +.Synopsis +Script uninstalls the Arcserve UDP Agent software. If the backup server software (Console or +Recovery Point Server) is detected, the script will exit. + +#> +$App_Name = 'Arcserve UDP Agent' + +###################### +### Functions ### +###################### +Function Get-Software ($CPU = $ENV:PROCESSOR_ARCHITECTURE) { + if ($CPU -eq 'AMD64') { + $32bit = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* + $64bit = Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* + $32bit + $64bit + } + else { + Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* + } +} + +Function Check-ExitCode { + If ($ExitCode -eq 0) { + Write-Host `n + $a = Get-Software | Where-Object { $_.DisplayName -eq $App_Name } | Select DisplayName, DisplayVersion | FL + If ($a -ne $null) { + Write-Host "ERROR: Script reports successful uninstall, but $App_Name still shows in Programs and Features" + $a + } + Else { + Write-Host "$App_Name Successfully Uninstalled." + } + } + ElseIf ($ExitCode -eq 3010) { + Write-Host `n + + $a = Get-Software | Where-Object { $_.DisplayName -eq $App_Name } | Select DisplayName, DisplayVersion | FL + If ($a -ne $null) { + Write-Host "ERROR: Script reports successful uninstall, but $App_Name still shows in Programs and Features" + $a + } + Else { + Write-Host "$App_Name Successfully Uninstalled, but requires a reboot to complete." + } + } + Else { + Write-Host `n + Write-Host "ERROR: $App_Name failed to uninstall. Exit Code:" + $ExitCode + } +} + +###################### +### Script start ### +###################### +$Applist = Get-Software | Where-Object { $_.DisplayName -eq $App_Name } | select Displayname, Uninstallstring +$Console = Get-Software | Where-Object { $_.DisplayName -eq 'Arcserve UDP Console' } +$RecoveryPointServer = Get-Software | Where-Object { $_.DisplayName -eq 'Arcserve UDP Recovery Point Server' } + +If ($Applist -ne $null) { + If ($Console -ne $null -or $RecoveryPointServer -ne $null) { + Write-Host "This server is the Arcseve UDP Console or RecoveryPoint server. Exiting..." + } + ElseIf ($ENV:PROCESSOR_ARCHITECTURE -eq 'AMD64') { + $UninstallerPath = 'C:\Program Files (x86)\Arcserve\SharedComponents\Arcserve Unified Data Protection\Setup\uninstall.exe' + $ArgumentList = '/q /ALL' + $Uninstall = Start-Process $UninstallerPath -ArgumentList $ArgumentList -wait -PassThru -NoNewWindow + $ExitCode = ($Uninstall).ExitCode + Check-ExitCode + } + Else { + $UninstallerPath = 'C:\Program Files\Arcserve\SharedComponents\Arcserve Unified Data Protection\Setup\uninstall.exe' + $ArgumentList = '/q /ALL' + $Uninstall = Start-Process $UninstallerPath -ArgumentList $ArgumentList -wait -PassThru -NoNewWindow + $ExitCode = ($Uninstall).ExitCode + Check-ExitCode + } +} +Else { + Write-Host "The $App_Name software does not exist on this machine. Exiting..." +} \ No newline at end of file