Script to delete a WMI instance from WMI repository

 

This is a script to delete a WMI instance from the WMI repository.   This was used when the deployment status were failing infroming there was another deployment in progress where as it was not there. This was because of the issue with the entry present in the WMI.

In this example we are deleting the instance Root\CCM\SoftwareUpdates\DeploymentAgent\CCM_DeploymentTaskEx1.nkey=1
You can change the path and delete any instance accordingly

 SCRIPT

=======

'============================================================================================
'Script Written by Sudheesh Narayanaswamy
'This script will delete the instance Root\CCM\SoftwareUpdates\DeploymentAgent\CCM_DeploymentTaskEx1.nkey=1
'For the UAC enabled systems please run the script from run as command prompt and use csript

'==============Start of Script======================================

strComputer = "."
strNamespace = "\Root\CCM\SoftwareUpdates\DeploymentAgent"
strInstance = "CCM_DeploymentTaskEx1.nkey=1"

Set objSWbemServices = GetObject("winmgmts:\\" & strComputer & strNamespace)
objSWbemServices.Delete strInstance

'==============End of script============================================

Sudheesh Narayanaswamy | Support Engineer | Microsoft