|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Get Registry Key Using WSH & ASP
<i><b>Originally posted by : Sandy (sandy.perez@ogilvy.com)</b></i><br /><br />I am trying to read registry keys using the wshShell object. I can read a value with no problem, but if I try to read a key I get a "Unable to open registry key for read" error. My code is as follows:<br /><br />------------------------------------------<br />dim wshShell<br />Set wshShell = server.CreateObject("WScript.Shell")<br /><br />'READ REGISTRY VALUE - WORKS FINE<br /><br />response.write wshShell.regread("HKLMSOFTWAREMicrosoftWindows NTCurrentVersionProductName")<br /><br />'READ REGISTRY KEY - THROWS "Unable to open registry key for read" ERROR <br /><br />response.write wshShell.regread("HKLMSOFTWAREODBCODBC.INIODBC Data Sources"")<br /><br />Set wshShell = nothing <br />------------------------------------------<br /><br />If anyone could shed light on this, I would really appreciate it. Thanks!<br />
|
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : steve (steve@aspfree.com)</b></i><br />hi sandy, i tried your code and got the same result. however i put in the localserver key after the odbc data sourceslocalserver and it return the proper information. I'd guess, i don't have my book in front of me but there is another method to use to read a collection of keys with in what your trying to do.<br />steve<br /><br /><br />------------<br />Sandy at 6/26/2001 5:38:41 PM<br /><br /><br />I am trying to read registry keys using the wshShell object. I can read a value with no problem, but if I try to read a key I get a "Unable to open registry key for read" error. My code is as follows:<br /><br />------------------------------------------<br />dim wshShell<br />Set wshShell = server.CreateObject("WScript.Shell")<br /><br />'READ REGISTRY VALUE - WORKS FINE<br /><br />response.write wshShell.regread("HKLMSOFTWAREMicrosoftWindows NTCurrentVersionProductName")<br /><br />'READ REGISTRY KEY - THROWS "Unable to open registry key for read" ERROR <br /><br />response.write wshShell.regread("HKLMSOFTWAREODBCODBC.INIODBC Data Sources"")<br /><br />Set wshShell = nothing <br />------------------------------------------<br /><br />If anyone could shed light on this, I would really appreciate it. Thanks!<br />
|
|
#3
|
|||
|
|||
|
<i><b>Originally posted by : Richard (richard@trinet.co.uk)</b></i><br />When you use RegRead on a key, you are trying to read the "(Default Value)" value. The error means that the default value is not set. If you set the value, you will be able to read it. WSH doesn't seem to have a method for reading all values in a key.<br /><br />------------<br />steve at 6/30/2001 12:12:42 PM<br /><br />hi sandy, i tried your code and got the same result. however i put in the localserver key after the odbc data sourceslocalserver and it return the proper information. I'd guess, i don't have my book in front of me but there is another method to use to read a collection of keys with in what your trying to do.<br />steve<br /><br /><br />------------<br />Sandy at 6/26/2001 5:38:41 PM<br /><br /><br />I am trying to read registry keys using the wshShell object. I can read a value with no problem, but if I try to read a key I get a "Unable to open registry key for read" error. My code is as follows:<br /><br />------------------------------------------<br />dim wshShell<br />Set wshShell = server.CreateObject("WScript.Shell")<br /><br />'READ REGISTRY VALUE - WORKS FINE<br /><br />response.write wshShell.regread("HKLMSOFTWAREMicrosoftWindows NTCurrentVersionProductName")<br /><br />'READ REGISTRY KEY - THROWS "Unable to open registry key for read" ERROR <br /><br />response.write wshShell.regread("HKLMSOFTWAREODBCODBC.INIODBC Data Sources"")<br /><br />Set wshShell = nothing <br />------------------------------------------<br /><br />If anyone could shed light on this, I would really appreciate it. Thanks!<br />
|
|
#4
|
|||
|
|||
|
RegRead error on key
This is an old post, so noone may care -- but this issue just cost me several hours.
The VBScript "RegRead" method, when applied to a registry KEY (as opposed to a VALUE) does not behave as the Microsoft documentation suggests. When you specify a KEY (evidenced by a trailing "\"), RegRead actually looks for the DEFAULT VALUE in the KEY, not the KEY itself. If the value "(default)" is not assigned, the RegRead will fail -- even though the KEY itself really does exist. RegRead directed to a KEY will only succeed if the "(default)" value has been assigned. |
|
#5
|
|||
|
|||
|
Sorry, I realize this is a basic question. But what I need to do is to read all the keys under the hotfix (NT) section in the registry, and I'm getting the "unable to open for reading" error. I need to read all of the currently installed patches, so that I can write a script to automate their installation and keep them up to date. I have about 500 unpatched nt 4.0 machines, and no SMS or other software to do it.
I inherited a mess... |
|
#6
|
|||
|
|||
|
Microsoft has released a command line tool call qfecheck.exe to report the Hotfixes installing on a system.
URL I think you can create an log file from qfecheck that you could use as input to into our produre. |
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > Get Registry Key Using WSH & ASP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|