Update StackMonkey.ps1

This commit is contained in:
2025-07-02 21:52:12 -04:00
parent 1afaefe310
commit 201a760041

View File

@@ -219,30 +219,44 @@
function Perform-Cleanup {
Write-LogHybrid "Cleanup mode enabled. Starting cleanup..." "Info" "SVSModule"
# Uninstall all versions of the module from all users
# Attempt to uninstall all versions of SVSMSP
try {
Uninstall-Module -Name SVSMSP -AllVersions -Force -Confirm:$false
Uninstall-Module -Name SVSMSP -AllVersions -Force -Confirm:$false -ErrorAction Stop
Write-LogHybrid "SVSMSP module uninstalled from system." "Success" "SVSModule"
} catch {
}
catch {
# If no module was found, just warn and continue
if ($_.Exception.Message -match 'No match was found') {
Write-LogHybrid "No existing SVSMSP module found to uninstall." "Warning" "SVSModule"
}
else {
Write-LogHybrid "Failed to uninstall SVSMSP: $($_.Exception.Message)" "Error" "SVSModule"
}
}
# Remove repository if you registered one
# Remove the custom repository if registered
if (Get-PSRepository -Name SVS_Repo -ErrorAction SilentlyContinue) {
try {
Unregister-PSRepository -Name SVS_Repo
Unregister-PSRepository -Name SVS_Repo -Confirm:$false -ErrorAction Stop
Write-LogHybrid "SVS_Repo repository unregistered." "Success" "SVSModule"
} catch {
}
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
try {
Remove-Module SVSMSP -Force -Confirm:$false -ErrorAction Stop
Write-LogHybrid "SVSMSP module removed from current session." "Success" "SVSModule"
}
catch {
Write-LogHybrid "Failed to remove SVSMSP from session: $($_.Exception.Message)" "Error" "SVSModule"
}
}
}
function Perform-ToolkitInstallation {