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 24 September 2012, 06:37 PM
  #1  
mike1210
Scooby Regular
Thread Starter
 
mike1210's Avatar
 
Join Date: Apr 2004
Location: Cardiff
Posts: 1,928
Likes: 0
Received 0 Likes on 0 Posts
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
Old 28 September 2012, 11:53 AM
  #2  
jonc
Scooby Regular
 
jonc's Avatar
 
Join Date: Apr 2002
Posts: 7,635
Likes: 0
Received 18 Likes on 13 Posts
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
Old 30 September 2012, 10:27 PM
  #3  
mike1210
Scooby Regular
Thread Starter
 
mike1210's Avatar
 
Join Date: Apr 2004
Location: Cardiff
Posts: 1,928
Likes: 0
Received 0 Likes on 0 Posts
Default

Tidy, many thanks for posting this
Old 01 October 2012, 12:27 PM
  #4  
jonc
Scooby Regular
 
jonc's Avatar
 
Join Date: Apr 2002
Posts: 7,635
Likes: 0
Received 18 Likes on 13 Posts
Default

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



Quick Reply: WMI Filtering on XP machines query



All times are GMT +1. The time now is 01:05 AM.