Sheridan Posted June 16, 2022 Posted June 16, 2022 I'm trying to create a WMI filter so I can apply a GPO to a whole OU, but simply block a handful of computers from applying it. The WMI filter is Select * From Win32_ComputerSystem Where Name <> "COMPUTER" and it always shows as True on the GPO modelling wizard. Its shows true if I change the filter to read ="COMPUTER" or <>"COMPUTER" so it suggests something else is wrong with my query, but I can't see what? Anyone else written a wmi query that will work like this?
Jobos Posted June 16, 2022 Posted June 16, 2022 Try using NOT instead of <> Select * From Win32_ComputerSystem Where NOT Name like "COMPUTER"
pantscat Posted June 16, 2022 Posted June 16, 2022 I think names need to be in single quotes - so try this: SELECT * FROM Win32_ComputerSystem WHERE name='COMPUTER' That oughta work!
andy_b Posted June 16, 2022 Posted June 16, 2022 Think it needs to be: SELECT NAME FROM Win32_ComputerSystem WHERE NOT (Name = "COMPUTER")
Sheridan Posted June 16, 2022 Author Posted June 16, 2022 I've tried all of these variations, with single and double quotes, and NOT rather than <> but in the Modelling wizard the Filter always shows as true - whether I enter the server name correctly or not. In fact I can't get it to show anything other than true!
andy_b Posted June 16, 2022 Posted June 16, 2022 If you are selecting the filter in the modelling wizard aren't you telling the wizard that the filter is explicitly true ? 1
Sheridan Posted June 16, 2022 Author Posted June 16, 2022 If you are selecting the filter in the modelling wizard aren't you telling the wizard that the filter is explicitly true ? D'oh! You're 100% right - I've just realised that you have to remove them. Its been a long week....... 1
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