Discussion:
Windows 2000 gives unexpected results using EnumKey
(too old to reply)
Meroveus
2009-03-31 01:19:08 UTC
Permalink
Here is the test script:

Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003

strComputer = "W2KServer"
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&_
strComputer & "\root\default:StdRegProv")

strKeyPath = ""

nRetVal=objReg.EnumKey(HKEY_USERS, strKeyPath, arrSubKeys)
For Each subkey In arrSubKeys
WScript.Echo subkey
Next

The output is:
AppEvents
Console
Control Panel
Environment
Identities
Keyboard Layout
Software
UNICODE Program Groups

This is especially puzzling, because on the server targeted, I added
an additional key to each of the logged-in users' hives. None of the
additions appear here, so I have no idea where this list came from.

On a Windows 2003 server, the output looks like this:
S-1-5-19
S-1-5-19_Classes
S-1-5-20
S-1-5-20_Classes
S-1-5-21-1229442621-1314001333-725765543-10062
S-1-5-21-1229442621-1314001333-725765543-10062_Classes
S-1-5-18

Which is what I expected.

Can someone please explain what on earth I'm missing, and better yet,
please tell me where it is documented.
Note that if I use HKEY_LOCAL_MACHINE in place of HKEY_USERS, both
servers respond the same -- ie they both give the contents of the hive
root.

Thanks,
Meroveus
Meroveus
2009-03-31 06:05:29 UTC
Permalink
<snipped>
Post by Meroveus
Can someone please explain what on earth I'm missing, and better yet,
please tell me where it is documented.
Note that if I use HKEY_LOCAL_MACHINE in place of HKEY_USERS, both
servers respond the same -- ie they both give the contents of the hive
root.
Thanks,
Meroveus
Apparently this issue is known, and the hotfix is here:
http://support.microsoft.com/?id=817478

I installed it, and re-ran the script and received the expected
output.
All is sweetness and light.

--Meroveus

Loading...