This project has moved and is read-only. For the latest updates, please go here.

SCCM Client Center's "delete root\ccm" functionality with "SCCMCLIENT" class

Mar 23, 2012 at 7:40 PM
Edited Mar 23, 2012 at 7:41 PM

I'm not sure if this question is appropriate for here, but I thought I'd try. We've used SCCM Client Center to delete the root\ccm namespace on systems where we've seen WMI namespace errors in the CCM logs in the past (while leaving the rest of the WMI namspaces intact), but recently we've had the need to do this for about 100 clients. To do this, I wanted to automate the process. 

I was unsuccessful finding a way to do this with standard PowerShell WMI cmdlets. The closest I got was to use Remove-WmiObject, but after that I wasn't able to start CCMEXEC anymore. I used SCCM Client Center to delete the namespace and it fixed it. What I was able to do was create an instance of SMSClient from sccmclictrlib and basically do what you do within SCCM Client Center. 

My question is, since you wrote both this library and SCCM Client Center, have you found a way to do this without creating a WMIProvider com object? I'd like to be able to either use SCCMClient or a PowerShell session so that this can be run on systems that are protected by firewalls.

Any insight would be appreciated. 



Mar 26, 2012 at 11:57 AM
Edited Mar 26, 2012 at 11:59 AM
Hi Rich

The Source Code for the part to delete the ccm namespace can be found here (Line 835):

C# Code:
oSMSClient.Connection.mScope.Path.NamespacePath = "root";

In Powershell, it would try it with:
Remove-WmiObject -query "SELECT * FROM __Namespace WHERE Name='CCM'" -Namespace "root"

..but i've not tested it :-)

Mar 26, 2012 at 4:35 PM

Thanks.. I'll test that out. I also made a little more progress after I posted this. What now looks promising is




Mar 28, 2012 at 4:02 PM

So neither of those worked. It doesn't look like Remove-WMIObject supports queries. What did work through is the following. 


Invoke-Command -ComputerName $server {gwmi -query "SELECT * FROM __Namespace WHERE Name='CCM'" -Namespace "root" | Remove-WmiObject}


That also now has the added benefit of working over WinRM since Invoke-Command uses WinRM to make it's connection. Thanks for the help and pointing me in the right direction!