1
votes

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
1
I don't see anyting wrong with your CMD code. Please show your VBScript code. - Ansgar Wiechers
I added the info about the call - Petr Osipov
Change the commandline to cmd /c reg import ... >>C:\reg.log 2>&1, so that you get a log with the actual output from the import command. Also check the exit code: rc = oShell.Run(sCmd, 0 , True) : If rc <> 0 Then WScript.Echo "Reg import failed. Exit code: " & rc. - Ansgar Wiechers
Thanks! Tried that - there's an error in the log file! FEHLER: Fehler beim ???ffnen der Datei. Es ist m???glicherweise ein Datentr???ger- bzw. Dateisystemfehler aufgetreten. - that means ERROR: Error opening file - probably a file system or drive error. The return code is however 0. - Petr Osipov
Did you already check the filesystem for errors? - Ansgar Wiechers

1 Answers

0
votes

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.