I have a script that works fine as a standalone. I now need to embed some logic in to it. I need for it to look at the results and make a decision based on what it finds. here is my script:
**************************************************************
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
const REG_SZ = 1
const REG_EXPAND_SZ = 2
const REG_BINARY = 3
const REG_DWORD = 4
const REG_MULTI_SZ = 7
strOriginalKeyPath = "SYSTEM\CurrentControlSet\Control\Class"
FindKeyValue(strOriginalKeyPath)
'-------------------------------------------------------------------------
Function FindKeyValue(strKeyPath)
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
errorCheck = oReg.EnumKey(HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys)
If (errorCheck=0 and IsArray(arrSubKeys)) then
For Each subkey In arrSubKeys
strNewKeyPath = strKeyPath & "\" & subkey
FindKeyValue(strNewKeyPath)
Next
End If
oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath, _
arrValueNames, arrValueTypes
If (errorCheck=0 and IsArray(arrValueNames)) then
For i=0 To UBound(arrValueNames)
'Wscript.Echo "Value Name: " & arrValueNames(i)
if arrValueNames(i) = "PnPCapabilities" then
strValueName = arrValueNames(i)
oReg.GetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
wscript.echo "HKEY_LOCAL_MACHINE\" & strkeyPath & vbNewLine & "Contains: " & dwValue
end if
Next
End If
end Function
**************************************************************
What I need to do i add something like this:
**************************************************************
Select Case dwValue
If dwValue = "32" Then
WScript.Echo "Wake On LAN is enabled."
Else
If dwValue = "288" Then
wscript.Echo "Wake On LAN is enabled."
Else
If Else: wscript.Echo "Wake On LAN is NOT enabled, please correct this now."
End If
**************************************************************
I have two values that = "ON" and any other value, or no value found needs to = "OFF"
Anybody have any ideas?
Ed
**************************************************************
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
const REG_SZ = 1
const REG_EXPAND_SZ = 2
const REG_BINARY = 3
const REG_DWORD = 4
const REG_MULTI_SZ = 7
strOriginalKeyPath = "SYSTEM\CurrentControlSet\Control\Class"
FindKeyValue(strOriginalKeyPath)
'-------------------------------------------------------------------------
Function FindKeyValue(strKeyPath)
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
errorCheck = oReg.EnumKey(HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys)
If (errorCheck=0 and IsArray(arrSubKeys)) then
For Each subkey In arrSubKeys
strNewKeyPath = strKeyPath & "\" & subkey
FindKeyValue(strNewKeyPath)
Next
End If
oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath, _
arrValueNames, arrValueTypes
If (errorCheck=0 and IsArray(arrValueNames)) then
For i=0 To UBound(arrValueNames)
'Wscript.Echo "Value Name: " & arrValueNames(i)
if arrValueNames(i) = "PnPCapabilities" then
strValueName = arrValueNames(i)
oReg.GetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
wscript.echo "HKEY_LOCAL_MACHINE\" & strkeyPath & vbNewLine & "Contains: " & dwValue
end if
Next
End If
end Function
**************************************************************
What I need to do i add something like this:
**************************************************************
Select Case dwValue
If dwValue = "32" Then
WScript.Echo "Wake On LAN is enabled."
Else
If dwValue = "288" Then
wscript.Echo "Wake On LAN is enabled."
Else
If Else: wscript.Echo "Wake On LAN is NOT enabled, please correct this now."
End If
**************************************************************
I have two values that = "ON" and any other value, or no value found needs to = "OFF"
Anybody have any ideas?
Ed