/build/static/layout/Breadcrumb_cap_w.png

Registry - null value required

Hi all,

Bit of a strange one this. I have an app packaged which includes an Informix client. A key is written to the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Informix\SqlHosts\<hostname>\OPTIONS.

For our app to work this must be a null value but on install the Informix client sets it to 0 which throws up errors. How can I prevent this happening?

0 Comments   [ + ] Show comments

Answers (4)

Posted by: Robo Scripter 20 years ago
Orange Senior Belt
0
If I am reading your question correctly.
Try this;
'----------------code start ----------------------
Dim oNet
Set oNet = WScript.CreateObject("wscript.network")
strComputer = oNet.ComputerName
const HKEY_LOCAL_MACHINE = &H80000002
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Informix\SqlHosts\" & strComputer
strValueName = "OPTIONS"
strValue = vbNullString
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
'----------------code end ----------------------

Regards,
Posted by: Gripper 20 years ago
Senior Yellow Belt
0
That's fantastic, thanks. I didn't mean <hostname> to refer to the local PC name though, it's the host it's connecting to. I've no experience with VB script, how would I remove the feature that looks up the local machine name?
Posted by: Robo Scripter 20 years ago
Orange Senior Belt
0
Not a problem, just a minor change.

Notice the new varible called strHostName, just replace the text between the quotes and your done.

'----------------code start ----------------------
Dim oNet
Set oNet = WScript.CreateObject("wscript.network")
strComputer = oNet.ComputerName
strHostName = "Enter the Host Name Here between the quotes"
const HKEY_LOCAL_MACHINE = &H80000002
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Informix\SqlHosts\" & strHostName
strValueName = "OPTIONS"
strValue = vbNullString
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
'----------------code end ----------------------

I would recommend that you attempt to get a copy of the "Windows 2000 Scripting Guide" ISBN: 0735618674.
There is a wealth of information to be had there.

Kind Regards,
Posted by: Gripper 20 years ago
Senior Yellow Belt
0
That works a treat - thanks very much!

Thanks for the book recommendation too, I've been looking for one for a while now in order to start learning more about scripting.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ