Petr Osipov
Petr Osipov

Reputation: 619

Reg file import from VBS incomplete

I have a following problem:

Customer's custom install script needs to import a reg file. It is done from a VBScript file running in system context with the command (32bit)

cmd /c reg import reg_neu32Bit.reg /reg:32

or 64bit

cmd /c reg import reg_neu.reg /reg:64

When run manually from console with admin rights, it imports all the keys successfully. When run from the VBScript however, the import breaks off in the middle, with no feedback, only some keys (up to the line NetworkServerFile) are imported, no keys below this line are found in registry.

The reg file looks like this:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Company\__Tool3]
"EnableEM"="True"
"EnableRegistry"="True"


[HKEY_LOCAL_MACHINE\SOFTWARE\SOME_SOFT\Tool3_V3\SOMETHING]
"PathToInstantClient"="C:\\Program Files\\SOME_SOFT\\Tool3_V3\\instant_client"
"MemorySize"="640000"
"RowCount"="1000"
"CONNECTIONTYPE"="SOMETHING"
"NetworkServerStatus"="False"
"NetworkServerFile"=""
"CheckIsAdmin"="success"
"PWD"="123456......................"
"TNS"="appp"
"USR"="app"
"NLS_LANG"="GERMAN_GERMANY.AL16UTF16"
"BIN_PWD"=hex:ab.....
"TNS_ADMIN"="\\\\somenetpath"

Any idea why this could happen?


Edit:

VBScript code:

ReDim Preserve aShellRunAI(0)
If iBits = 64 Then
   aShellRunAI(0) = "cmd /c reg import reg_neu.reg /reg:64"
Else
   aShellRunAI(0) = "cmd /c reg import reg_neu32Bit.reg /reg:32"
End If

and later in sequence:

For Each sCmd In aShellRunAI
    WriteToLog 0, "sCmd:" & sCmd
    Call oShell.Run(sCmd, 0, True)
Next

Upvotes: 1

Views: 1983

Answers (1)

Petr Osipov
Petr Osipov

Reputation: 619

Despite the working directory of the script being set to correct path, the problem was resolved in my case by using absolute path instead of relative. Apparently, using relative path caused the .reg files not being found at all, and the registry entries matching the first lines of the .reg file were created by the exe installer called before that.

Upvotes: 0

Related Questions