Click to See Complete Forum and Search --> : Get Registry Value


IxxI
08-09-2004, 05:21 AM
I'm using this code:


Set wshShell = server.CreateObject("WScript.Shell")
wshShell.regread("HKEY_CURRENT_USER\Software\Serious Samurize\General\DirPath")


To read a registry key. When called in a vbs file (using Samurize) it works fine, however in asp it returns:


error '80070002'
The system cannot find the file specified.
/samurize.asp, line 8


What's wrong with it??
Cheers,
IxxI

CardboardHammer
08-09-2004, 10:35 AM
Is there code trying to open a file on line 8 that depends on the result of wshShell.regread? Do a response.write of wshShell.regread, bail out of processing the page after that, and see what you get.

IxxI
08-09-2004, 10:51 AM
Sorry didn't make it clear the regread line is line 8 - that's what I don't understand. I tried it with the reponse.write before I posted and just got the same error.
Cheers,
IxxI

CardboardHammer
08-09-2004, 11:01 AM
Perhaps the account that ASP runs under doesn't have permission to read the registry?

Or perhaps HKEY_CURRENT_USER isn't valid for that account? (In which case, could the same needed info be found under a different branch of the registry? Perhaps HKEY_LOCAL_MACHINE?)

IxxI
08-09-2004, 11:08 AM
Hmm, maybe - I was running it under my account and when I checked with regedit I could see it but I'll try that and see what happens,
thanks,
IxxI