Search code examples
powershellsccm

Early filtering within the root\ccm\cliensdk namespace


I recently wrote a script that updates registry values on remote desktops after checking, for instance, that a certain application, MyApp, is properly installed.

The aforementioned application is installed/deployed by SCCM (2012, not R2 for the moment).

In the process of optimizing the script, I wanted to change the test of the install state of MyApp (from late to early filtering). So far, no luck and so far, no explanation either.

I can't properly understand why it seems not possible to do some early filtering with the following command :

gwmi -ComputerName myserver -Namespace root\ccm\clientsdk -query "select * from ccm_application where Fullname='MyApp'"

Of course, nor can we use :

gwmi -ComputerName myserver -Namespace root\ccm\clientsdk -class ccm_application -filter "Fullname='MyApp'"

Late filtering, of course, works but I wanted (and expected) early filtering to work, especially since I am checking the Install state of an app for quite a lot of remote desktops.

Of course, I do know that I could (can) use SCCM for that purpose (executing a script only if ...) but that still does not explain why I can't do early filtering.


Solution

  • Whenever I try to query that class with my installation while specifying either properties or a filter, I get the error "Provider is not capable of the attempted operation". It doesn't matter if I use Get-WmiObject or Get-CimInstance.

    I get the same error when I run this:

    PS C:\> WMIC.EXE /NAMESPACE:\\root\ccm\clientsdk PATH ccm_application GET FullName
    Node - <SERVERNAME>
    ERROR:
    Description = Provider is not capable of the attempted operation
    
    PS C:\> wmic /NAMESPACE:\\root\ccm\clientsdk PATH ccm_application WHERE "FullName='Java 32-bit'"
    Node - <SERVERNAME>
    ERROR:
    Description = Provider is not capable of the attempted operation
    

    Although this works just fine:

    WMIC.EXE /NAMESPACE:\\root\ccm\clientsdk PATH ccm_application
    

    Seems like a limitation of the provider then, not a problem with your code. -Filter and -Property don't work by design.

    Note that I am using 2012 R2 SP1 (5.00.8239.1000), so this may not perfectly apply. However, it seems unlikely that they would remove the functionality from the provider moving from 2012 to 2012 R2.