fixed the perform-cleanup function
This commit is contained in:
@@ -217,9 +217,33 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
function Perform-Cleanup {
|
function Perform-Cleanup {
|
||||||
Write-LogHybrid "Cleanup mode enabled. Starting cleanup..." "Info" "SVSModule"
|
Write-LogHybrid "Cleanup mode enabled. Starting cleanup..." "Info" "SVSModule"
|
||||||
# …your old cleanup logic here…
|
|
||||||
}
|
# 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 {
|
function Perform-ToolkitInstallation {
|
||||||
Perform-Cleanup
|
Perform-Cleanup
|
||||||
|
|||||||
Reference in New Issue
Block a user