FN-GM Posted April 14, 2011 Posted April 14, 2011 Hi, I am after some WMI Filters. for the following Windows XP Machines (32 Bit) Windows 7 Machines (32 Bit maybe 64) Windows Server 2008 R2 Terminal Server Session I have found the following for Windows XP Machines Root\CimV2; Select * from Win32_OperatingSystem where Caption = "Microsoft Windows XP Professional" I have found this for Windows 7 Machines select * from Win32_OperatingSystem WHERE Version like "6.1%" AND ProductType="1" For Server 2008 R2 i have come up with nothing. As Server 2008 is windows 6.1 will it apply the above WMI? Maybe we could have something like this for Server 2008 R2 and 7? Will the below ones work? Root\CimV2; Select * from Win32_OperatingSystem where Caption = "Microsoft Windows 7" Root\CimV2; Select * from Win32_OperatingSystem where Caption = "Microsoft Windows Server 2008 R2" Thanks
mounters Posted April 14, 2011 Posted April 14, 2011 Does this help at all Step 7: Creating WMI and Group Filters 1
FN-GM Posted April 14, 2011 Author Posted April 14, 2011 Ok so for windows XP i will have: select * from Win32_OperatingSystem where Version like "5.1%" and ProductType = "1" For Windows 7 I will have select * from Win32_OperatingSystem where Version like "6.1%" and ProductType = "1" For Server 2008 R2 i will have select * from Win32_OperatingSystem where Version like "6.1%" and ProductType = "3" Thanks allot
mounters Posted April 14, 2011 Posted April 14, 2011 Are you sure? Do you not just need to use the ProductType and then 1 = clients, 2 = servers that are DCs, 3 = member servers.
FN-GM Posted April 14, 2011 Author Posted April 14, 2011 Beat me to it! I deleted the last post as i cant read! So do those filters sound ok to you? I shall be doing some testing this weekend! Thanks
FN-GM Posted April 14, 2011 Author Posted April 14, 2011 (edited) I also assume you can apply these to user & computer policies? Also i assume that the namespace is set to root\CIMv2 Thanks Edited April 14, 2011 by FN-GM
Arthur Posted April 14, 2011 Posted April 14, 2011 Re: post #3, there are lots of different ways of doing the same thing... [b]Windows XP[/b] SELECT Version, ProductType FROM Win32_OperatingSystem WHERE Version = '5.1%' AND ProductType = '1' SELECT Version, ProductType from Win32_OperatingSystem WHERE Version = '5.1.2600' AND ProductType = '1' SELECT Version, ProductType from Win32_OperatingSystem WHERE Version LIKE '5.1.%' AND ProductType = '1' [b]Windows 7[/b] SELECT Version, ProductType FROM Win32_OperatingSystem WHERE Version = '6.1%' AND ProductType = '1' SELECT Version, ProductType FROM Win32_OperatingSystem WHERE Version = '6.1.7600' AND ProductType = '1' SELECT Version, ProductType FROM Win32_OperatingSystem WHERE Version LIKE '6.1.%' AND ProductType = '1' [b]Windows Server 2008 R2[/b] SELECT Version, ProductType FROM Win32_OperatingSystem WHERE Version = '6.1%' AND ProductType <> '1' SELECT Version, ProductType FROM Win32_OperatingSystem WHERE Version = '6.1.7600' AND ( ProductType = '2' OR ProductType = '3' ) SELECT Version, ProductType FROM Win32_OperatingSystem WHERE Version LIKE '6.1.%' AND ProductType <> '1' Some other filters you may find useful... [b]32-bit OS[/b] SELECT OSArchitecture FROM Win32_OperatingSystem WHERE OSArchitecture='32-bit' [b]64-bit OS[/b] SELECT OSArchitecture FROM Win32_OperatingSystem WHERE OSArchitecture='64-bit' [b]NOT A Server OS[/b] SELECT ProductType FROM Win32_OperatingSystem WHERE ProductType = '1' [b]NOT a laptop (assumes every laptop uses SO-DIMM RAM)[/b] SELECT FormFactor FROM Win32_PhysicalMemory WHERE FormFactor != 12
FN-GM Posted April 16, 2011 Author Posted April 16, 2011 Does anyone have a WMI that will only apply a computer that begins with ZY4 please? We have some computers called ZY4-01, ZY4-02 etc.. Thanks
Arthur Posted April 16, 2011 Posted April 16, 2011 (edited) SELECT * FROM Win32_ComputerSystem WHERE Name LIKE 'ZY4%' [b]or[/b] SELECT Name FROM Win32_ComputerSystem WHERE Name LIKE 'ZY4%' In fact, you can query the computer name from literally any WMI class. e.g. SELECT SystemName FROM Win32_ParallelPort WHERE SystemName LIKE 'ZY4%' If you should ever need to query more than one group of computers, you can do it like this... SELECT * FROM Win32_ComputerSystem WHERE (Name LIKE 'ZY4%' OR Name LIKE 'ZY5%') Edited April 16, 2011 by Arthur 1
FN-GM Posted April 20, 2011 Author Posted April 20, 2011 Me again I was wondering if you know of a WMI that will apply a user policy based on Client Name? I would like to apply a policy for users that use a thin client based on the thin client name. When you make a script in VBS instead of using computer name you use client name. Do you have any ideas please? Thanks
FN-GM Posted April 21, 2011 Author Posted April 21, 2011 Terminal Session Targeting (in 2008/2008 R2)? Never knew that existed. Thanks
FN-GM Posted April 22, 2011 Author Posted April 22, 2011 Sorry me again. For re-directed start menus i will have to separate Windows 7 x86 & x64. Would you use these WMI please? select * from Win32_OperatingSystem WHERE Version like "6.1%" AND ProductType="1" AND WHERE OSArchitecture='32-bit' select * from Win32_OperatingSystem WHERE Version like "6.1%" AND ProductType="1" AND WHERE OSArchitecture='64-bit' Thanks
Arthur Posted April 25, 2011 Posted April 25, 2011 These should do it... Windows 7 x86 SELECT * FROM WIN32_OperatingSystem WHERE Version LIKE '6.1.%' AND ProductType=1 AND OSArchitecture='32-bit' Windows 7 x64 SELECT * FROM WIN32_OperatingSystem WHERE Version LIKE '6.1.%' AND ProductType=1 AND OSArchitecture='64-bit' 1
FN-GM Posted May 16, 2011 Author Posted May 16, 2011 (edited) Hi me again I want to make a WMI that will NOT apply to computers not begging with LAP. Would this do the trick please? SELECT * FROM Win32_ComputerSystem WHERE IS NOT Name LIKE 'LAP%' Thanks very much Edited May 16, 2011 by FN-GM
Arthur Posted May 17, 2011 Posted May 17, 2011 SELECT * FROM Win32_ComputerSystem WHERE NOT Name LIKE "LAP%" or SELECT * FROM Win32_OperatingSystem WHERE (NOT CSName LIKE "LAP%") AND (Version LIKE "6.1%" AND ProductType = "1") The second WMI query will do what you originally wanted to do. 1
FN-GM Posted May 17, 2011 Author Posted May 17, 2011 Ha thanks, What i am doing it setup a redirected start menu, but i do not want it to apply when a user logs into a laptop. Thanks
FN-GM Posted July 7, 2011 Author Posted July 7, 2011 (edited) Hi I am using this code to apply a group policy to laptops begging with LTOP. SELECT * FROM Win32_ComputerSystem WHERE Name LIKE 'LTOP%' The computer is called LTOP-001 but the policy does not apply with the WMI on. If i remove it the policy applies just fine when i enable it again it fails to work. Any ideas please? Edited July 7, 2011 by FN-GM
ChrisMiles Posted July 7, 2011 Posted July 7, 2011 Aren't your laptops in a different OU? WMI filters are slow and shoudn't really be used instead of good AD organisation. Make a Laptops OU, move them into it and apply the policy to that OU only.
FN-GM Posted July 7, 2011 Author Posted July 7, 2011 Aren't your laptops in a different OU? WMI filters are slow and shoudn't really be used instead of good AD organisation. Make a Laptops OU, move them into it and apply the policy to that OU only. They already are in there own OU. Anyway its a user policy so doing that wouldnt apply
ChrisMiles Posted July 7, 2011 Posted July 7, 2011 They already are in there own OU. Anyway its a user policy so doing that wouldnt apply Ok, sorry then, that's no help. The WMI query is correct. The only thing I can think is that wmi doesnt correctly report the computer name at the point during startup where the filter is checked. Maybe try filtering on DNSHostName instead?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now