I was trying to find an example of how to see if a registry key exists.
I image it assigning a value to a variable. if the reg key exists, then the
variable
will have some length, and then assumed to be true, else no length: false.
javatrue =regtheregistry([HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java
Plug-in])
if len(javatrue)>0 then
response.write "Yeah! We have Java Virtual Machine!!"
else
response.write "No, you do NOT have Java Virtual Machine installed on
this computer."
end if
Is my logic sound? Can anyone assist me please? Thank you!
Now as for the second use, you could create a script using Microsoft Windows
Script and use the RegRead Method. For the documents check
http://www.microsoft.com/scripting .
PER THE DOCS:
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Echo WshShell.RegRead("HKCU\ScriptEngine\Val") ' Read from value
"Val".
WScript.Echo WshShell.RegRead("HKCU\ScriptEngine\Key\") ' Read from key
"Key".
Bryan Martin
Sp...@ahwayside.com
"dhi" <nos...@dhimaging.com.au> wrote in message
news:4xcb9.20585$MC2....@news-server.bigpond.net.au...
> Now as for the second use, you could create a script using Microsoft Windows
> Script and use the RegRead Method. For the documents check
> http://www.microsoft.com/scripting .
>
> PER THE DOCS:
> Set WshShell = WScript.CreateObject("WScript.Shell")
> WScript.Echo WshShell.RegRead("HKCU\ScriptEngine\Val") ' Read from value
> "Val".
> WScript.Echo WshShell.RegRead("HKCU\ScriptEngine\Key\") ' Read from key
> "Key".
You will need to error handle this as well, the script will "crash" if you try
to read a non-existing value.
--
torgeir
> WScript.Echo WshShell.RegRead("HKCU\ScriptEngine\Key\") ' Read from key
How can I get all "directories" resisting in that path/directory. I'm
talking about registry directories.
Alexander
> WScript.Echo WshShell.RegRead("HKCU\ScriptEngine\Key\") ' Read from key
How can I recursivly travel through all "directories" which are stored
in that key to search for a special key/value pair?
Alexander
Hi
You can use WMI for this...
EnumKey method
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/enumkey_method_in_class_stdregprov.asp
EnumValues
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/enumvalues_method_in_class_stdregprov.asp
Here is a VBScript/WMI example that walks a registry branch echoing all keys.
The third parameter (Boolean True/False) to the sub EnumRegistryKey will
determine if the sub is to stop at first level or traverse the complete tree:
Set oRegistry = GetObject("winmgmts:root/default:StdRegProv")
Const HKCR = &H80000000 'HKEY_CLASSES_ROOT
Const HKCU = &H80000001 'HKEY_CURRENT_USER
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
Const HKEY_USERS = &H80000003
Const HKEY_CURRENT_CONFIG = &H80000005
Const HKEY_DYN_DATA = &H80000006
EnumRegistryKey HKCU, _
"Software\Microsoft\Windows\CurrentVersion\Group Policy", True
Sub EnumRegistryKey(hive, key, DeepTraversal)
On Error Resume Next
rc = oRegistry.EnumKey(hive, key, arSubKeys)
For Each sKey In arSubKeys
If Err Then
Err.Clear
Exit Sub
End If
WScript.Echo key & "\" & sKey
If DeepTraversal Then
EnumRegistryKey hive, key & "\" & sKey, True
End If
Next
End Sub
Some Script Center examples:
Enumerate Subkeys
http://www.microsoft.com/technet/scriptcenter/registry/scrreg09.asp
Enumerate Registry Values and Types
http://www.microsoft.com/technet/scriptcenter/registry/scrreg08.asp
--
torgeir
> You can use WMI for this...
I don't develop this script for myself, someone else asked me to
create it for his own needs (small firm). They're using Win95 and
Win98. My question now: What are the requirements for WMI? Are they
installed on Win95/98 by default?
Alexander
> > You can use WMI for this...
>
> What are the requirements for WMI?
> Are they installed on Win95/98 by default?
This technology is somehow new... needed Win2k or later. So it won't
work on Win95/98. Thanks anyway.
Alexander
"Alexander Schuch" <alex....@gmx.de> wrote in message
news:3d6efe50....@news.cis.dfn.de...
"Alexander Schuch" <alex....@gmx.de> wrote in message
news:3d6f0270....@news.cis.dfn.de...