Reply to Message

View discussion in a popup

Replying to:
JoJoGabor
Expert
Expert

I have never had any issues with the SCCM client being baked into the template as long as you delete the certs and delete the file I mentioned above

Why bother removing the agent on Decommissioning? Just let the VM be deleted, and delete the object in SCCM using the command:

$compObject = get-wmiobject -query "select * from SMS_R_SYSTEM WHERE Name='$vm'" -computername SCCMServer -namespace "ROOT\SMS\sitecode"

$compObject.psbase.delete()

This looks similar to what you are doing anyway