diff --git a/Scriptmonkey_Beta.ps1 b/Scriptmonkey_Beta.ps1 index 1256a7b..93befd5 100644 --- a/Scriptmonkey_Beta.ps1 +++ b/Scriptmonkey_Beta.ps1 @@ -1780,12 +1780,18 @@ function Handle-CleanupSVSMSP { param($Context) try { - if (Get-Command Cleanup-SVSMSP -ErrorAction Stop) { - Cleanup-SVSMSP - Write-LogHybrid "SVSMSP toolkit cleanup complete" Success OffBoard -LogToEvent + if (Get-Command Install-SVSMSP -ErrorAction Stop) { + # This will: + # - Uninstall SVSMSP + # - Unregister SVS_Repo + # - Remove SVSMSP from the session + # - Delete HKLM:\Software\SVS\Deployment (via Remove-SVSDeploymentRegKey) + Install-SVSMSP -Cleanup + + Write-LogHybrid "SVSMSP toolkit cleanup complete (module, repo, registry)." Success OffBoard -LogToEvent Respond-Text $Context "SVSMSP toolkit cleanup complete." } else { - throw "Cleanup-SVSMSP cmdlet not found in SVSMSP toolkit." + throw "Install-SVSMSP function not found in current session." } } catch {