Hi All
I've been trying to run a simple WMI script to read a value from registry path on HKEY_USERS (See below), . but haven't been able to get it to work on Windows 2000 SP4 machines for some reason (works OK on NT4 SP6a machines)...returnvalue/err.number I get is 2. Even trying to enumerate subkeys under HKEY_USERS I'm unable to do it (HKLM is fine), wondering if anyone else has seen this problem, if this is a bug or a functionality that has been taken away recently by Service Packs, hotfixes... or if there is anything wrong you can see with the script below.... any help is much appreciated. Thanks in Advance...

------------------------------------------------------------
Const HKEY_LOCAL_MACHINE = &H8000000
Const HKEY_USERS = &H80000003
CONST HKEY_CURRENT_USER = &H8000000

Set objreg = Getobject("winmgmts:{impersonationLevel=impersonate}!\\TESTPC\root\default:StdRegProv"

regpath = "S-1-5-21-1606980848-1965331169-1417001333-233556\Software\DFS\IRESS\File

retval = objreg.getstringvalue (HKEY_USERS,Regpath,"userdir", regvalue
wscript.echo "Retval is: " & retva
wscript.echo "regvalue: " & regvalu

Re: WMI unable to read HKEY_USERS by Torgeir

Torgeir
Mon Feb 09 04:21:04 CST 2004

Mark A wrote:

> I've been trying to run a simple WMI script to read a value from registry path on HKEY_USERS (See below), . but haven't been able to get it to work on Windows 2000 SP4 machines for some reason (works OK on NT4 SP6a machines)...returnvalue/err.number I get is 2. Even trying to enumerate subkeys under HKEY_USERS I'm unable to do it (HKLM is fine), wondering if anyone else has seen this problem, if this is a bug or a functionality that has been taken away recently by Service Packs, hotfixes...

Hi

It is a know bug, and a hotfix is available:

Cannot Use WMI to Query HKEY Users After You Install SP4
http://support.microsoft.com/?id=817478

As the article states, you need to call Microsoft Product Support Services to
obtain it (outside the US, customers should contact their local Microsoft
subsidiary.). The support call will be be free as long as you refer to the
Knowledge Base Article number and ask for nothing more.

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Re: WMI unable to read HKEY_USERS by anonymous

anonymous
Tue Mar 02 18:31:07 CST 2004

Thanks Torgeir.. I'll try and get the hotfix.