Solved

WMI query that worked in SCCM 2007 doesnt work in SCCM 2012

Posted on 2015-01-19
3
878 Views
Last Modified: 2015-02-13
Hi,

 We use a lot of task sequences in order to install complex applications through our sccm environment.
 We are right now in the process to migrate from SCCM 2007 to SCCM 2012 and have discovered an issue with certain wmi-queries that worked fine in SCCM 2007 but now generate an error in SCCM 2012.
 Task sequences has been migrated with the migration tool in SCCM 2012 and we have doublechecked that the wmi-queries are identical between 2007 and 2012.

 Troubleshooting further running wbemtest to run the WMI-Queries, gives an error when running on a  CM 2012 client (W7 Ent x64 SP1) but works as expected on a CM 2007 client (W7 Ent x64 SP1).

 Have run the Query with local-admin rights on both clients.
 The wmi-query looks like this:

Select * From SMS_InstalledSoftware Where ProductCode = '{AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE}'

Namespace: root\cimv2\sms

 Running wbemtest on cm2012 client returns an error :
Number: 0x80041017
 Facility: WMI
 Description: Invalid query

The query is used to choose an alternative installation behaviour if some certain application is found to be installed.
 We know that there are optional wmi-queries to use that will work in CM 2012, but in this case we would prefer to leave all migrated task sequences untouched if possible.

 Could there be some central configuration missing, access rights etc that could explain why the wmi-query doesnt run on a CM 2012 client?

 Would be grateful for any advice where to look next to find a smooth solution.
0
Comment
Question by:cowiekspert
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 84

Accepted Solution

by:
oBdA earned 500 total points
ID: 40559230
According to the official Microsoft documentation (see links below), the ProductCode property should be there both in SCCM 2007 and 2012.
In reality, it seems like this property went AWOL in SCCM 2012; might be intentional (and forgotten in the documentation), or one of the many bugs in SCCM.
I can confirm for SCCM 2012 (don't have 2007 at hand) that this property is missing, so I'm afraid you'll have to change your query:
PS C:\> Get-WmiObject -Namespace "root\cimv2\sms" -Class "SMS_InstalledSoftware" | Get-Member


   TypeName: System.Management.ManagementObject#root\cimv2\sms\SMS_InstalledSoftware

Name                       MemberType    Definition
----                       ----------    ----------
PSComputerName             AliasProperty PSComputerName = __SERVER
ARPDisplayName             Property      string ARPDisplayName {get;set;}
ChannelCode                Property      string ChannelCode {get;set;}
ChannelID                  Property      string ChannelID {get;set;}
CM_DSLID                   Property      string CM_DSLID {get;set;}
EvidenceSource             Property      string EvidenceSource {get;set;}
InstallDate                Property      string InstallDate {get;set;}
InstallDirectoryValidation Property      uint32 InstallDirectoryValidation {get;set;}
InstalledLocation          Property      string InstalledLocation {get;set;}
InstallSource              Property      string InstallSource {get;set;}
InstallType                Property      uint32 InstallType {get;set;}
Language                   Property      uint32 Language {get;set;}
LocalPackage               Property      string LocalPackage {get;set;}
MPC                        Property      string MPC {get;set;}
OsComponent                Property      uint32 OsComponent {get;set;}
PackageCode                Property      string PackageCode {get;set;}
ProductID                  Property      string ProductID {get;set;}
ProductName                Property      string ProductName {get;set;}
ProductVersion             Property      string ProductVersion {get;set;}
Publisher                  Property      string Publisher {get;set;}
RegisteredUser             Property      string RegisteredUser {get;set;}
ServicePack                Property      string ServicePack {get;set;}
SoftwareCode               Property      string SoftwareCode {get;set;}
SoftwarePropertiesHash     Property      string SoftwarePropertiesHash {get;set;}
SoftwarePropertiesHashEx   Property      string SoftwarePropertiesHashEx {get;set;}
UninstallString            Property      string UninstallString {get;set;}
UpgradeCode                Property      string UpgradeCode {get;set;}
VersionMajor               Property      uint32 VersionMajor {get;set;}
VersionMinor               Property      uint32 VersionMinor {get;set;}
__CLASS                    Property      string __CLASS {get;set;}
__DERIVATION               Property      string[] __DERIVATION {get;set;}
__DYNASTY                  Property      string __DYNASTY {get;set;}
__GENUS                    Property      int __GENUS {get;set;}
__NAMESPACE                Property      string __NAMESPACE {get;set;}
__PATH                     Property      string __PATH {get;set;}
__PROPERTY_COUNT           Property      int __PROPERTY_COUNT {get;set;}
__RELPATH                  Property      string __RELPATH {get;set;}
__SERVER                   Property      string __SERVER {get;set;}
__SUPERCLASS               Property      string __SUPERCLASS {get;set;}
ConvertFromDateTime        ScriptMethod  System.Object ConvertFromDateTime();
ConvertToDateTime          ScriptMethod  System.Object ConvertToDateTime();

Open in new window


SMS_InstalledSoftware Client WMI Class
Applies To: System Center Configuration Manager 2007, System Center Configuration Manager 2007 R2, System Center Configuration Manager 2007 R3, System Center Configuration Manager 2007 SP1, System Center Configuration Manager 2007 SP2
http://msdn.microsoft.com/en-us/library/cc144824.aspx

SMS_InstalledSoftware Client WMI Class
Applies To: System Center 2012 Configuration Manager, System Center 2012 Configuration Manager SP1, System Center 2012 R2 Configuration Manager
http://msdn.microsoft.com/en-us/library/jj874298.aspx
0
 
LVL 23

Expert Comment

by:Nagendra Pratap Singh
ID: 40561209
It appears that using SoftwareCode  may work. I have not  tried it but I found a link which says so.

Select * From SMS_InstalledSoftware Where SoftwareCode  = '{XXXXXXXXXXXXXXXXXXXXXXXXXX}'

http://www.windows-noob.com/forums/index.php?/topic/7573-software-task-sequence-wmi-query-for-installed-software/
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
A quick guide on how to use Group Policy to create a custom power plan and set it active on Windows 7.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question