nuke the reg key on -cleanup

This commit is contained in:
2025-11-23 17:41:59 -05:00
parent a8dd390b80
commit 242da1dca1

View File

@@ -337,6 +337,23 @@ $ConfirmPreference = 'None'
} }
} }
function Remove-SVSDeploymentRegKey {
$regKey = 'HKLM:\Software\SVS\Deployment'
try {
if (Test-Path $regKey) {
Remove-Item -Path $regKey -Recurse -Force
Write-LogHybrid "Registry key '$regKey' deleted successfully." "Success" "SVSModule" -LogToEvent
}
else {
Write-LogHybrid "Registry key '$regKey' not found; nothing to delete." "Info" "SVSModule" -LogToEvent
}
}
catch {
Write-LogHybrid "Failed to delete registry key '$regKey': $($_.Exception.Message)" "Error" "SVSModule" -LogToEvent
}
}
# Remove the custom repository if registered # Remove the custom repository if registered
if (Get-PSRepository -Name SVS_Repo -ErrorAction SilentlyContinue) { if (Get-PSRepository -Name SVS_Repo -ErrorAction SilentlyContinue) {
try { try {
@@ -375,8 +392,12 @@ $ConfirmPreference = 'None'
} }
Write-LogHybrid "Install-SVSMSP called" "Info" "SVSModule" -LogToEvent Write-LogHybrid "Install-SVSMSP called" "Info" "SVSModule" -LogToEvent
if ($Cleanup) { if ($Cleanup) {
Perform-Cleanup; return
Perform-Cleanup
Remove-SVSDeploymentRegKey
return
} }
if ($InstallToolkit) { if ($InstallToolkit) {
Perform-ToolkitInstallation; return Perform-ToolkitInstallation; return