select * from Win32_ComputerSystem where Name = ‘Computer Name’
If you are looking for more WMI Filter examples, this article has it all…
Here is another example of how to target Windows 7 by its architecture type (X86 or X64). This is great while deploying applications through Group Policy. Not all the applications are compatible both 32 and 64 bit, so you can target only 32bit or only 64bit computers with the help of this WMI query.
Here is how it looks like to target only Windows 7 X86 Systems
select * from Win32_OperatingSystem WHERE Version like "6.1%" AND ProductType="1" AND NOT OSArchitecture = "64-bit"
Targeting Windows 7 X64 Systems
select * from Win32_OperatingSystem WHERE Version like "6.1%" AND ProductType="1" AND OSArchitecture = "64-bit"
But, how do you make sure that these WMI queries are actually working? Of course, you can go ahead and try to apply it to a GPO and try on with a couple of machines… Or you can download this little utility from the www.gpoguy.com website written by Darren Mar-Elia. This tool is handy when it comes to try out your WMI filters in your GPO. The tool can pull all configured queries from your Active Directory and validate them. If you are working a lot with GPO’s and WMI’s, this tool is a must have. Here is the link to the download page;
I thought, while we are in the subject, why don’t I give away all my secret weapons in terms of WMI coding…
Here is a little list of tools that might save you hours of work and make you look like a decent programmer J
|PowerGUI||A Graphical User Interface and script editor for Microsoft Windows
|WMICode Creator||Generates code in VBScript, C#, and Visual Basic® .NET; you can run
the code directly from the tool. You can generate code to query for
management information, execute a management task, or receive event
This utility that writes WMI scripts for you. (And, in the process, teaches you the fundamental concepts behind writing WMI scripts for yourself.)