FN-GM Posted July 18, 2011 Author Posted July 18, 2011 (edited) 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? Working now, just started to work for some reason SELECT * FROM Win32_OperatingSystem WHERE (NOT CSName LIKE "LAP%") AND (Version LIKE "6.1%" AND ProductType = "1") Will this code apply a policy to computers that: Are not begging with LAP But is a Windows 7 machine? Thanks Edited July 18, 2011 by FN-GM
Arthur Posted July 18, 2011 Posted July 18, 2011 The WMI filter looks fine to me. Btw, if you wanted to quickly test whether or not it will apply, you could use a program called WMI Filter Validator. 1
FN-GM Posted July 24, 2011 Author Posted July 24, 2011 Hi, Im not in work so cant use the WMI Filter Validator. I just put this together, would this do the same as post 26 and only apply to 32 bit machines? SELECT * FROM Win32_OperatingSystem WHERE (NOT CSName LIKE "LAP%") AND (Version LIKE "6.1%" AND ProductType = "1") AND (OSArchitecture='32-bit') Would this apply to machines begging with LAP that are 32bit machines? SELECT * FROM Win32_ComputerSystem WHERE (Name LIKE 'LAP%') AND (OSArchitecture='32-bit') Sorry to pester just want to get this bang on
Arthur Posted July 24, 2011 Posted July 24, 2011 The first one looks fine, although you don't really need all of those brackets... SELECT * FROM Win32_OperatingSystem WHERE (NOT CSName LIKE "LAP%") AND (Version LIKE "6.1%" AND ProductType = "1" AND OSArchitecture='32-bit') [b]or[/b] SELECT * FROM Win32_OperatingSystem WHERE NOT CSName LIKE "LAP%" AND Version LIKE "6.1%" AND ProductType = "1" AND OSArchitecture='32-bit' The second filter won't work however because the Win32_ComputerSystem class doesn't have a property called OSArchitecture. Use this instead... SELECT * FROM Win32_OperatingSystem WHERE CSName LIKE 'LAP%' AND OSArchitecture='32-bit' 1
FN-GM Posted October 30, 2011 Author Posted October 30, 2011 Hi, I am looking for a WMI for Windows ThinPC. I wonder if anyone can help please? Thanks
SYNACK Posted October 30, 2011 Posted October 30, 2011 Run this on one "wmic OS Get Caption" assuming it has that exe and then filter by what it says. it should give you the OS caption which it probably different and so filterable for.
Arthur Posted October 31, 2011 Posted October 31, 2011 Here's the PowerShell equivalent of Synack's WMIC command should you need it. (Get-WmiObject -Class win32_OperatingSystem).caption
FN-GM Posted January 18, 2012 Author Posted January 18, 2012 Sorry for the long reply. Only just got time to carry on with the project. Once i have run that what would i do with the information displayed please?
Arthur Posted January 18, 2012 Posted January 18, 2012 A few examples... Windows 7 Ultimate Select * FROM Win32_OperatingSystem WHERE (Caption = "[color="#FF0000"]Microsoft Windows 7 Ultimate[/color]") Windows 7 (All Editions) Select * FROM Win32_OperatingSystem WHERE (Caption LIKE "[color="#FF0000"]Microsoft Windows 7[/color]%") 1
FN-GM Posted March 3, 2012 Author Posted March 3, 2012 (edited) @Arthur Sorry for the long reply What do we need the brackets for? If i want to use the above caption to detect 7 and 32 bit would this do please? SELECT * FROM WIN32_OperatingSystem WHERE (Caption LIKE "Microsoft Windows 7%") AND (OSArchitecture='32-bit') Thanks Edited March 3, 2012 by FN-GM
Arthur Posted March 4, 2012 Posted March 4, 2012 (edited) What do we need the brackets for? I'm not sure why I did it, but the brackets aren't required in the example above. I think I woke up too early that day. For future reference, if you have a WMI filter which contains several different Boolean operators (ANDs and ORs for example), make sure you read this article first. If I want to use the above caption to detect 7 and 32 bit would this do please? Your example is fine. Another alternative would be to check the OS version... SELECT * FROM WIN32_OperatingSystem WHERE Version LIKE '6.1.%' AND OSArchitecture='32-bit' I would also try to avoid using too many WMI filters if you can. Item-level targeting of GPPs will almost always be faster (if that is an option?)... WMI filters take some percentage of performance away each and every time Group Policy processing is evaluated. That is, at every logon, at startup and every 90 minutes thereafter, you'll take a little performance hit because WMI filters are re-evaluated. So, be careful and don’t link a GPO to the domain level or every single Windows XP machine and later will work hard to evaluate that WMI query. (Source) WMI Filters have been around since Windows XP/2003 and are a great way to filter your Group Policy Objects based on the hardware of the computer that the policy is applied. However performing a WMI queries can take a substantial amount of time and if you have multiple WMI filters applying to your computers you have a significant performance decrease. Once again you can get around having to resort to using WMI Filters as Group Policy Preference Item-Level Targeting also have a number of options you can target hardware. Unlike WMI the Preference targeting engine has the performance advantage of being written in native code so it is much faster at determining what setting to apply. (Source) Edited March 5, 2012 by Arthur 1
FN-GM Posted March 5, 2012 Author Posted March 5, 2012 I would also try to avoid using too many WMI filters if you can. Item-level targeting of GPPs will almost always be faster (if that is an option?)... For what I am using it won't help :-) Also I only have a few I am tweaking existing ones. I also can't use the WMI thta you posted as it picks up Windows Thin PC as well so that's why I am making tweaks to the existing ones. Thanks for your help :-)
FN-GM Posted March 22, 2012 Author Posted March 22, 2012 Hi @Arthur do you know a WMI to pickup a clientname on an RDP session please? The option i want to do cant be done via group policy preferences. Thanks
Arthur Posted March 23, 2012 Posted March 23, 2012 Not sure to be honest. Are you able to use the %ClientName% environment variable like you did in this thread?
FN-GM Posted March 23, 2012 Author Posted March 23, 2012 Yep seems to work, i dont think its possible. I have been googling and found nothing. Thanks
rich_tech Posted April 17, 2012 Posted April 17, 2012 Apologies for raising a very old thread here, I really dont normally do this, but this has thrown up a possible answer to a fiddly problem were having at the moment and I want to know if what I propose is achievable :- SELECT * FROM Win32_OperatingSystem WHERE Version = '6.1%' AND ProductType = '1' AND ( OSArchitecture="32-bit" OR OSArchitecture="64-bit" ) Basically, we are now looking at Windows 7 64 bit in the school that I work in and we are finding that our GPOs arent applying to the 64 bit clients, this is because of the existing 32 bit only filtering in place, so I am obviously trying to create a WMI filter to allow us to include the 64 bit machines into the fray, would the WMI filter that I have put above work ? (I got it off an existing 64 bit WMI filter in our forest and wanted to know if what I have altered in here is going to get the results we want. or can anyone help guide me in the right path if possible ? Thanks, Richard
FN-GM Posted April 17, 2012 Author Posted April 17, 2012 select * from Win32_OperatingSystem where Version like "6.1%" and ProductType = "1" That will pickup both 32 and 64 1
kennysarmy Posted May 10, 2012 Posted May 10, 2012 Slightly different take on the same theme: I have the following working WMI filters: Select * from Win32_OperatingSystem Where Version like "5.1%" and ProductType = "1" Select * from Win32_OperatingSystem Where Version like "6.1%" and ProductType = "1" So I can target XP and Win7 seperately. I know want to add Win7 64bit in to the fray as a new WMI filter Anything existing can be filetered as is I reckon, so I just need a new WMI filter so I can target specific policies to 64 bit windows 7. Would this work for the new WMI filter? Select * from Win32_OperatingSystem Where Version like "6.1%" and ProductType = "1" and AddressWidth="64" I am also wondering if I should edit my existing WMI filter for Windows 7 so that it applies only to 32 bit. Or would three WMI filters for Windows 7 give me most flexibility. One for all flavours, one for 32 bit and one fore 64 bit Does anyone else do it that way? So I am guessing I would have: Select * from Win32_OperatingSystem Where Version like "6.1%" and ProductType = "1" and AddressWidth="64" Select * from Win32_OperatingSystem Where Version like "6.1%" and ProductType = "1" and AddressWidth="32" SELECT * FROM Win32_OperatingSystem WHERE Version = '6.1%' AND ProductType = '1' AND ( OSArchitecture="32-bit" OR OSArchitecture="64-bit" ) Comments appreciated.
Arthur Posted May 10, 2012 Posted May 10, 2012 So I can target XP and Win7 separately. The OSArchitecture property in Win32_OperatingSystem isn't supported on XP.
penfold Posted July 30, 2012 Posted July 30, 2012 I'm moving the way we deploy printers over to GPP and have got a problem where it causes an issue when logging onto Terminal Services. We don't need printers installing when using TS so I wanted to get a WMI filter to exclude the machines begining with TS. Can I do this by using something similar to below SELECT * FROM Win32_OperatingSystem WHERE (NOT CSName LIKE "LAP%") AND (Version LIKE "6.1%" AND ProductType = "3") Replacing LAP% for TS% We still have some Windows XP clients so I thought it would be easier to apply the Group Policy only if the user wasn't logging onto a TS machine rather than applying it to every Windows Client we have. Would this work?
penfold Posted July 30, 2012 Posted July 30, 2012 I've tried this and it seems to work ok when I check it with the WMI Filter Validator SELECT * FROM Win32_OperatingSystem WHERE (NOT CSName LIKE "TS%") AND (NOT ProductType="3") Can anyone see any reason why I couldn't use this?
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