Solved

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

Posted on 2015-01-19
3
854 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
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

856 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