One good use of Group Policy Preferences is in controlling Windows Services. You can read how to do so here on Alan Burchill’s site, as it’s the same method that I use.
I sometimes go one step farther, and only apply that preference item if the service actually exists. “How do you do that?”, I hear you say. By using Item-Level Targeting and a WMI query.
One instance where I’ve used this previously is to control Adobe’s auto-update services. If the service doesn’t exist on a machine for one reason or another, the event logs will be full of errors like this:
The computer 'Disable Flash Player Update Service' preference item in the 'Policy Name Here {00000000-0000-0000-0000-00000000000}' Group Policy Object did not apply because it failed with error code '0x80070424 The specified service does not exist as an installed service.' This error was suppressed.
To test if the service is installed, first find out the Service Name, as opposed to the Display Name. That’s what we’ll use in the WMI query.
Then, apply the following WMI targeting query:
Query | select * from win32_service where name = “AdobeARMservice” |
Namespace | Rootcimv2 |
Property | Name |
Variable Name |
The targeting editor should look like this afterwards:
Thanks! Just what I was looking for.
LikeLike
Thanks. Apologies for the missing screenshots on these older blog posts of mine.
LikeLiked by 1 person