nuke the reg key on -cleanup
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user