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?
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)
Please log in to answer
Posted by:
Robo Scripter
20 years ago
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,
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
Posted by:
Robo Scripter
20 years ago
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,
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
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.