How can I write a query to find machines which installed office 2003 with Sp3 in SCCM 2007?
Thanks,
The easiest way to do this is just to use reports rather than queries. There are built-in reports that will tell you all the machines with a particular version of a particular product installed. Have a look at the reports in the "Software - Companies and Products" category, like "Computers with a specific product name and version".
If however you actually do need a query, if for instance, you need to create a collection of all of these that you can advertise a specific software package to, then the easiest way is to search for a particular file that will be common to all of these machines.
For example, if you know that the install packages used in your company always install Outlook as part of Office, you could use a query like this that looks for the Outlook EXE file, and checks its version.
For example by setting these criteria in a query:
Software Files.File Name is equal to "outlook.exe"
and
Software Files.File Version is greater than or equal to "11.0.8173.0"
Or this is the query language that the above translates into (this can be pasted into the Show Query Language box):
select SMS_R_System.ResourceId, SMS_R_System.ResourceType, SMS_R_System.Name, SMS_R_System.SMSUniqueIdentifier, SMS_R_System.ResourceDomainORWorkgroup, SMS_R_System.Client
from SMS_R_System
inner join SMS_G_System_SoftwareFile on SMS_G_System_SoftwareFile.ResourceID = SMS_R_System.ResourceId
where SMS_G_System_SoftwareFile.FileName = "outlook.exe"
and SMS_G_System_SoftwareFile.FileVersion >= "11.0.8173.0"
For info, file versions for various Office versions and service packs can be found in these Technet pages: