constKEY_QUERY_VALUE=&H0001
constKEY_SET_VALUE=&H0002
constKEY_CREATE_SUB_KEY=&H0004
constDELETE=&H00010000
constHKEY_LOCAL_MACHINE=&H80000002
strComputer="."
SetStdOut=WScript.StdOut
SetoReg=GetObject("winmgmts:{impersonationLevel=impersonate}!"&_
strComputer&"rootdefault:StdRegProv")
strKeyPath="SYSTEMCurrentControlSet"
oReg.CheckAccessHKEY_LOCAL_MACHINE,strKeyPath,KEY_QUERY_VALUE,bHasAccessRight
IfbHasAccessRight=TrueThen
StdOut.WriteLine"HaveQueryValueAccessRightsonKey"
Else
StdOut.WriteLine"DoNotHaveQueryValueAccessRightsonKey"
EndIf
oReg.CheckAccessHKEY_LOCAL_MACHINE,strKeyPath,KEY_SET_VALUE,bHasAccessRight
IfbHasAccessRight=TrueThen
StdOut.WriteLine"HaveSetValueAccessRightsonKey"
Else
StdOut.WriteLine"DoNotHaveSetValueAccessRightsonKey"
EndIf
oReg.CheckAccessHKEY_LOCAL_MACHINE,strKeyPath,KEY_CREATE_SUB_KEY,bHasAccessRight
IfbHasAccessRight=TrueThen
StdOut.WriteLine"HaveCreateSubKeyAccessRightsonKey"
Else
StdOut.WriteLine"DoNotHaveCreateSubKeyAccessRightsonKey"
EndIf
oReg.CheckAccessHKEY_LOCAL_MACHINE,strKeyPath,DELETE,bHasAccessRight
IfbHasAccessRight=TrueThen
StdOut.WriteLine"HaveDeleteAccessRightsonKey"
Else
StdOut.WriteLine"DoNotHaveDeleteAccessRightsonKey"
EndIf