Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

WMI Filtering on XP machines query

Thread Tools
 
Search this Thread
 
Old Sep 24, 2012 | 06:37 PM
  #1  
mike1210's Avatar
mike1210
Thread Starter
Scooby Regular
 
Joined: Apr 2004
Posts: 1,928
Likes: 0
From: Cardiff
Default WMI Filtering on XP machines query

Hi All,
I need to make a WMI filter that checks for a registry key value and only applies to Windows XP machines.

----------------------------------------------------------------------

HKEY_LOCAL_MACHINE\Software\KasperskyLab\AVP6\Sett ings
Key called EnableSelfProtection
1 = Self defence on
0 = Self defence off

----------------------------------------------------------------------

I need it to apply only if the above value is zero

I already have the filter for XP machines only but can I have 2 conditions in a WMI filter?

I cannot use item level targeting as it's for a software install

Has anyone done something similar. I think VB scripts are an option but I'm turd at them
Reply
Old Sep 28, 2012 | 11:53 AM
  #2  
jonc's Avatar
jonc
Scooby Regular
 
Joined: Apr 2002
Posts: 7,647
Likes: 22
Default

Are you talking about doing something like this in VBScript?

strComputer = "."
const HKEY_LOCAL_MACHINE = &H80000002

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonat e}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
If objOperatingSystem.Caption = "Microsoft Windows XP" Then

Set oReg = GetObject("winmgmts:{impersonationLevel=impersonat e}!\\" & strComputer & "\root\default:StdRegProv")

strKeyString = "EnableSelfProtection"
strKeyPath = "Software\KasperskyLab\AVP6\Settings"

oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strKeyString, strValue

If IsNull(strValue) Then
WScript.Echo "Reg Key doesn't exist!"
WScript.quit
elseIf strValue = "0" Then
WScript.Echo "Do whatever you need to do"
WScript.Quit
Else
WScript.Echo "Value data not 0!"
Wscript.Quit
End If
End If
Next
Reply
Old Sep 30, 2012 | 10:27 PM
  #3  
mike1210's Avatar
mike1210
Thread Starter
Scooby Regular
 
Joined: Apr 2004
Posts: 1,928
Likes: 0
From: Cardiff
Default

Tidy, many thanks for posting this
Reply
Old Oct 1, 2012 | 12:27 PM
  #4  
jonc's Avatar
jonc
Scooby Regular
 
Joined: Apr 2002
Posts: 7,647
Likes: 22
Default

No problem, glad I could help.
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
KAS35RSTI
Subaru
27
Nov 4, 2021 07:12 PM
Ganz1983
Subaru
5
Oct 2, 2015 09:22 AM
ALEXSTI
General Technical
5
Sep 28, 2015 09:29 PM
IAN WR1
ScoobyNet General
8
Sep 28, 2015 08:14 PM
Ozne
General Technical
2
Sep 27, 2015 03:06 PM




All times are GMT +1. The time now is 01:08 PM.