2

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.

projetnumero9
  • 61
  • 2
  • 13
  • I cannot help as I don't have access to that namespace for testing but have you tried do wildcard matches in case there is leading or trailing space in your app name? This assumes the rest of the query is fine. – Matt Oct 20 '15 at 14:34
  • Yes, I have, as well as tried with LIKE instead of =. As a side note, the following does not work either : gwmi -ComputerName myserver -Namespace root\ccm\clientsdk -query "select FullName from ccm_application" – projetnumero9 Oct 20 '15 at 14:39

1 Answers1

2

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.

Bacon Bits
  • 30,782
  • 5
  • 59
  • 66
  • Thanks, at least that corroborates my findings so far. – projetnumero9 Oct 21 '15 at 08:22
  • 1
    The only attribute that can be used in a filter-condition is the Id. At min you can define a dummy-filter like "Id like '%'" and then you can define the properties that you need (and skipping all unwanted props). – Carsten Jun 01 '22 at 07:50