-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUninstallCydef.ps1
More file actions
30 lines (25 loc) · 1.02 KB
/
UninstallCydef.ps1
File metadata and controls
30 lines (25 loc) · 1.02 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
# Finds and removes software related to Cydef Smart Monitor
# Written by Jonathan Bullock
# 2023 - 11 - 21
#
# Defining Cydef related software
$softwareName = "CyDef"
# Get the list of installed software with cydef in the name
$softwareList = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -like "*$softwareName*" }
# Check if any software was found
if ($softwareList) {
foreach ($software in $softwareList) {
# Output the name of the software being uninstalled
Write-Host "Uninstalling $($software.Name)..."
# Attempt to uninstall the software
$uninstallResult = $software.Uninstall()
# Check the result of the uninstallation
if ($uninstallResult.ReturnValue -eq 0) {
Write-Host "Successfully uninstalled $($software.Name)."
} else {
Write-Host "Failed to uninstall $($software.Name). Error code: $($uninstallResult.ReturnValue)"
}
}
} else {
Write-Host "No software found with the name containing '$softwareName'."
}