fixed the perform-cleanup function

This commit is contained in:
2025-07-02 21:45:14 -04:00
parent 3c22ef6691
commit 1afaefe310

View File

@@ -217,9 +217,33 @@
)
function Perform-Cleanup {
Write-LogHybrid "Cleanup mode enabled. Starting cleanup..." "Info" "SVSModule"
# …your old cleanup logic here…
}
Write-LogHybrid "Cleanup mode enabled. Starting cleanup..." "Info" "SVSModule"
# Uninstall all versions of the module from all users
try {
Uninstall-Module -Name SVSMSP -AllVersions -Force -Confirm:$false
Write-LogHybrid "SVSMSP module uninstalled from system." "Success" "SVSModule"
} catch {
Write-LogHybrid "Failed to uninstall SVSMSP: $($_.Exception.Message)" "Error" "SVSModule"
}
# Remove repository if you registered one
if (Get-PSRepository -Name SVS_Repo -ErrorAction SilentlyContinue) {
try {
Unregister-PSRepository -Name SVS_Repo
Write-LogHybrid "SVS_Repo repository unregistered." "Success" "SVSModule"
} catch {
Write-LogHybrid "Failed to unregister SVS_Repo: $($_.Exception.Message)" "Error" "SVSModule"
}
}
# Finally, remove it from the current session if loaded
if (Get-Module -Name SVSMSP) {
Remove-Module SVSMSP -Force
Write-LogHybrid "SVSMSP module removed from current session." "Success" "SVSModule"
}
}
function Perform-ToolkitInstallation {
Perform-Cleanup