fix: update profile removal logic to use SID variable directly

This commit is contained in:
2025-10-08 18:07:07 -04:00
parent c6d587db8e
commit 253b714fe2
+1 -1
View File
@@ -27,7 +27,7 @@ Catch { Write-Error "The provisioning admin account could not be removed`n"+$_.E
# Fully remove the provisioning admin profile
Write-Output "Removing provisioning admin CIM instance"
Try { Get-CimInstance -Class Win32_UserProfile | Where-Object { $_.SID -eq $ProvisioningAdmin.SID.Value } -ErrorAction SilentlyContinue | Remove-CimInstance }
Try { Get-CimInstance -Class Win32_UserProfile | Where-Object { $_.SID -eq $SID } -ErrorAction SilentlyContinue | Remove-CimInstance }
Catch { Write-Error "The provisioning admin profile could not be removed`n"+$_.Exception.Message ; Exit 1 }
# Delete any remaining provisioning admin directories