wmi group policy filter

K

Kim Oppalfens

Hi all,

Anyone have an idea how to create a wmi filter that applies to a gpo,
that makes sure that the gpo only applies to computers that do NOT have a
certain service installed?
 
S

Scott McNairy \(MVP\)

Well the script would look like below, but I am unsure as to where/how to
apply one of these "WMI Policy Filters"

set svc = getobject("winmgmts:root\cimv2")
set objEnum = svc.execQuery("select __relpath From win32_service where name
= 'ServiceName' and state = 'running'"
for each obj in objEnum
wscript.echo " Found the service in a running state"
next

Hope that helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top