I am having difficulty with enumerating the contents of
the HKEY_USERS key of the registry. When I run it against
a Windows XP Pro SP1 box, it works properly. However, a
Windows 2000 Pro SP4 box does not return the correct
information (It looks like it might be information from
the HKEY_CURRENT_USER?).
I suspect it's a problem with the provider, but don't
know for sure. If so, is anyone aware of a workaround?
TIA,
Stephen
Here's my code:
PCName = "."
Set objLocator = CreateObject
("WbemScripting.SWbemLocator")
Set objService = objLocator.ConnectServer
(PCName, "Root\DEFAULT")
If Err.Number <> 0 Then
MsgBox "An error occurred while connecting to
the remote workstation.", vbCritical, "Error!"
Err.Clear
Exit Sub
End If
Set objRegistry = objService.Get("StdRegProv")
sPath
= "Software\Microsoft\Windows\CurrentVersion\Run"
result = objRegistry.EnumKey(HKEY_USERS, "",
arrSubKeys)
If Err.Number = 0 Then
For Each strSubKey In arrSubKeys
If Right(strSubKey, 8) <> "_Classes" Then
' objRegistry.GetStringValue HKEY_USERS,
strSubKey & "\" & sPath, strValue
' MsgBox strSubKey & vbCrLf &
strValue 'String(Len(strSubKey), "-")
varTemp = strSubKey & "\" & sPath
GetNCheck HKEY_USERS, varTemp
End If
Next
Else
MsgBox "Error " & Err.Description
End If