From 4c7be530e44e15823acfc50f6942f34e5033ae8c Mon Sep 17 00:00:00 2001 From: Stephan Yelle Date: Wed, 14 Jan 2026 02:12:52 -0500 Subject: [PATCH] Add src/handlers.offboard.ps1 --- src/handlers.offboard.ps1 | 84 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 src/handlers.offboard.ps1 diff --git a/src/handlers.offboard.ps1 b/src/handlers.offboard.ps1 new file mode 100644 index 0000000..5e958d7 --- /dev/null +++ b/src/handlers.offboard.ps1 @@ -0,0 +1,84 @@ +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)" + } +}