Quantcast
Channel: LANDESK User Community : Popular Discussions - Patch Manager
Viewing all articles
Browse latest Browse all 3522

VBScript Custom Definition Driving Me Nuts

$
0
0

Ok, I'm really stumped.  I was given a task to look for a key in the HKEY_CLASSES_ROOT branch of the registry.  Since LANDesk doesn't do that for detection natively, I wrote a quick script to do it.  I've tested this script manually on numerous computers, and it correctly reports if the key is there or not.  When I added it LANDesk and scan for it, it's returned that the key is found on ~2000 computers and not on 4.  I manually checked two of the 4 computers and the key is there on both (one of them is MY computer, and the key is most definitely there).  So when I run the script on my computer manually, it's sees the key.  When it runs in LANDesk, it doesn't see the key.  But it does on most computers (probably too many computers).  Any ideas what may be causing the problem?

 

 

Dim bVulnerable, sExpected, sReason, sFound

 

bVulnerable = False

 

If ReadRegKey("HKCR\Notes\") = "[None]" Then
    'VULNERABLE
    bVulnerable = True
    sExpected = "HKCR\Notes\"
    sFound = "[None]"
    sReason = """HKEY_CLASSES_ROOT\Notes"" was not found"
Else
    'Not Vulnerable
    bVulnerable = False
    sExpected = "HKCR\Notes\"
    sFound = "HKCR\Notes\"
    sReason = """HKEY_CLASSES_ROOT\Notes"" was found"
End If

 

Report bVulnerable, sExpected, sReason, sFound
'WScript.echo bVulnerable & sExpected & sReason & sFound

 

Function ReadRegKey(ByVal pstrRegKey)
    on Error Resume Next
    Dim Result
    Dim WSHShell
    Set WSHShell = CreateObject("WScript.Shell")
    Result = WSHShell.RegRead (pstrRegKey)

 

    If Hex(Err) = "80070002" Then
        Result = "[None]"
    End If

 

    ReadRegKey = Result

 

    Set WSHShell = Nothing

 

    on Error GoTo 0
end Function


Viewing all articles
Browse latest Browse all 3522

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>