Update App Uninstall Scripts/App - Cisco AnyConnect - Uninstall.ps1

This commit is contained in:
2025-08-06 23:39:34 +00:00
parent c4c261969e
commit 4b9deff63b
@@ -1,61 +1,60 @@
<#
Author: Gabe Kerntke
Company: UFS LLC
Date: 02-21-2024
.Synopsis
Script checks to see if Cisco AnyConnect is installed, if installed it will uninstall
.Modified
2024-02-21 (GabeK) - Original script created
#>
######################
### Variables ###
######################
$Name = "Cisco AnyConnect Secure Mobility Client"
######################
### 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"
#$Path = Get-ChildItem "C:\Users" -Recurse -Force | Where-Object {$_ -like "*Cisco AnyConnect*"}
#Foreach ($Item in $Path) {
#Remove-Item -Force -Recurse -Verbose -ErrorAction SilentlyContinue
#}
}
else {
Write-Host "Failed to uninstall $Name, exiting script"
}
}
######################
### 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"
<#
Author: Gabe Kerntke
Date: 02-21-2024
.Synopsis
Script checks to see if Cisco AnyConnect is installed, if installed it will uninstall
.Modified
2024-02-21 (GabeK) - Original script created
#>
######################
### Variables ###
######################
$Name = "Cisco AnyConnect Secure Mobility Client"
######################
### 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"
#$Path = Get-ChildItem "C:\Users" -Recurse -Force | Where-Object {$_ -like "*Cisco AnyConnect*"}
#Foreach ($Item in $Path) {
#Remove-Item -Force -Recurse -Verbose -ErrorAction SilentlyContinue
#}
}
else {
Write-Host "Failed to uninstall $Name, exiting script"
}
}
######################
### 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"
}