Option Explicit
Dim oShell
Private Function KeyExists (keyName)
Dim bKey
On Error Resume Next
bKey = oShell.RegRead(keyName)
If TypeName (bKey) = "Empty" Then
KeyExists = False
Else
KeyExists = True
End If
End Function
Set oShell = CreateObject("Wscript.Shell")
If keyExists("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\11.0\Access\Security\Level") Then
wscript.echo "Key exists"
Else
oshell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Office\11.0\Access\Security\Level", 1, "REG_DWORD"
End If
Set oShell = Nothing
|