Files
SAMY/src/handlers.offboard.ps1

85 lines
3.0 KiB
PowerShell

function Invoke-UninstallCyberQP {
param($Context)
try {
if (Get-Command Uninstall-CyberQP -ErrorAction Stop) {
Uninstall-CyberQP
Write-LogHybrid "CyberQP uninstalled" Success OffBoard -LogToEvent
Send-Text $Context "CyberQP uninstalled."
} else {
throw "Uninstall-CyberQP cmdlet not found in SVSMSP toolkit."
}
}
catch {
Write-LogHybrid "Error uninstalling CyberQP: $($_.Exception.Message)" Error OffBoard -LogToEvent
Send-Text $Context "ERROR: $($_.Exception.Message)"
}
}
function Invoke-UninstallHelpDesk {
param($Context)
try {
if (Get-Command Uninstall-HelpDesk -ErrorAction Stop) {
Uninstall-HelpDesk
Write-LogHybrid "SVS HelpDesk uninstalled" Success OffBoard -LogToEvent
Send-Text $Context "SVS HelpDesk uninstalled."
} else {
throw "Uninstall-HelpDesk cmdlet not found in SVSMSP toolkit."
}
}
catch {
Write-LogHybrid "Error uninstalling SVS HelpDesk: $($_.Exception.Message)" Error OffBoard -LogToEvent
Send-Text $Context "ERROR: $($_.Exception.Message)"
}
}
function Invoke-UninstallThreatLocker {
param($Context)
try {
if (Get-Command Uninstall-ThreatLocker -ErrorAction Stop) {
Uninstall-ThreatLocker
Write-LogHybrid "ThreatLocker uninstalled" Success OffBoard -LogToEvent
Send-Text $Context "ThreatLocker uninstalled."
} else {
throw "Uninstall-ThreatLocker cmdlet not found in SVSMSP toolkit."
}
}
catch {
Write-LogHybrid "Error uninstalling ThreatLocker: $($_.Exception.Message)" Error OffBoard -LogToEvent
Send-Text $Context "ERROR: $($_.Exception.Message)"
}
}
function Invoke-UninstallRocketCyber {
param($Context)
try {
if (Get-Command Uninstall-RocketCyber -ErrorAction Stop) {
Uninstall-RocketCyber
Write-LogHybrid "RocketCyber uninstalled" Success OffBoard -LogToEvent
Send-Text $Context "RocketCyber uninstalled."
} else {
throw "Uninstall-RocketCyber cmdlet not found in SVSMSP toolkit."
}
}
catch {
Write-LogHybrid "Error uninstalling RocketCyber: $($_.Exception.Message)" Error OffBoard -LogToEvent
Send-Text $Context "ERROR: $($_.Exception.Message)"
}
}
function Invoke-CleanupSVSMSP {
param($Context)
try {
if (Get-Command Install-SVSMSP -ErrorAction Stop) {
Install-SVSMSP -Cleanup
Write-LogHybrid "SVSMSP toolkit cleanup completed (module, repo, registry)." Success OffBoard -LogToEvent
Send-Text $Context "SVSMSP toolkit cleanup completed."
} else {
throw "Install-SVSMSP function not found in current session."
}
}
catch {
Write-LogHybrid "Error cleaning up SVSMSP toolkit: $($_.Exception.Message)" Error OffBoard -LogToEvent
Send-Text $Context "ERROR: $($_.Exception.Message)"
}
}