I actually looked at the StdRegProv in an early release of WMI when you had to create and register a
MOF (whatever that is ;-) and decided it was too much trouble at the time.
But with WMI (version 1.5 at least, which is the current downloadable version), StdRegProv doesn't
require any of the original MOF-ing around.
You can do registry access very simply, including enumerating key and value names (things not
possible with WshShell registry methods).
The VBScript example below is from a VB example (in the WMI docs) that was trivial to adapt to
VBScript. Unfortunately the code can't be adapted for JScript since it uses by reference method
arguments. But I just ran this on a Win98 box and it works like a charm...
'=====
' StdRegProv
' http://msdn.microsoft.com/library/psdk/wmisdk/regprovref_6yie.htm
'=====
set objRegistry = GetObject("winmgmts://./root/default:StdRegProv")
'Assumes objRegistry is a valid StdRegProv object.
Const HKEY_LOCAL_MACHINE = &H80000002
Dim lRC '==> As Long
Dim sPath '==> As String
Dim sKeys() '==> As Variant
sPath = "SOFTWARE\Microsoft\Windows"
On Error Resume Next
lRC = objRegistry.EnumKey(HKEY_LOCAL_MACHINE, sPath, sKeys)
If (lRC <> 0) or (Err.Number <> 0) Then
'An error occurred
End If
On Error GoTo 0
msgbox join(sKeys,vbCrLf)
--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup...
--