none
How to deploy software which requires a bat file? RRS feed

  • Question

  • So we use Teradata which uses a bat file to silently install. During the install you can configure which components you want installed in this manner: silent_install.bat "ODBC,TDNETDP,SQLA"

    The issue I am having is if I set this up in a task sequence MDT moves on to the next task sequence as soon as the bat file is ran so the install fails. I tried adding a wait command to the line based on some other posts I found: start "silent_install" /wait silent_install.bat "ODBC,TDNETDP,SQLA"

    How can I deploy software which is called from a bat file and prevent MDT from moving on to the next task sequence until the install is complete? I contacted Teradata and they were absolutely no help at all. Their answer was more or less "so don't deploy it from a task sequence if it doesn't work."

    Thursday, December 3, 2015 2:26 PM

Answers

  • If the batch simply runs an exe then you can use that as the "quiet install command" in your imported application, other wise if you'd like to use a script here's a template.

    <job id="Install-APPLICATION">
    <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
    <script language="VBScript">
     
    ' //***************************************************************************
    ' // Purpose: Template with error logging
    ' // Usage: cscript.exe Install-APPLICATION.wsf [/debug:true]
    ' // Creator: Daniel Vega
    ' // Version: 1.0 - 1/26/2015
    ' // Notes:
    ' //
    ' //***************************************************************************
     
    '//----------------------------------------------------------------------------
    '//
    '// Global constant and variable declarations
    '//
    '//----------------------------------------------------------------------------
     
    Option Explicit
     
    Dim iRetVal
     
    '//----------------------------------------------------------------------------
    '// End declarations
    '//----------------------------------------------------------------------------
     
    '//----------------------------------------------------------------------------
    '// Main routine
    '//----------------------------------------------------------------------------
     
    On Error Resume Next
    iRetVal = ZTIProcess
    ProcessResults iRetVal
    On Error Goto 0
     
    '//---------------------------------------------------------------------------
    '//
    '// Function: ZTIProcess()
    '//
    '// Input: None
    '//
    '// Return: Success - 0
    '// Failure - non-zero
    '//
    '// Purpose: Perform main ZTI processing
    '//
    '//---------------------------------------------------------------------------
    
    Function ZTIProcess()
    
    	Dim sSetupFile
    	Dim sArguments
    
    	sSetupFile = oUtility.ScriptDir & "\Source\APPLICATION.MSI"
    	sArguments = "/switches"
    
    	' Disable Zone Checks
    	oEnv("SEE_MASK_NOZONECHECKS") = 1
    
    	'Install APPLICATION
    
    	oLogging.CreateEntry oUtility.ScriptName & ": Starting installation", LogTypeInfo
    
    	If not oFSO.FileExists(sSetupFile) then
    		oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile & " was not found, unable to install", LogTypeError
    		ZTIProcess = Failure
    		Exit Function
    	End if
    
    	iRetVal = oUtility.RunWithHeartbeat("msiexec.exe /i """ & sSetupFile & """ " & sArguments & " /l*v """ & oUtility.LocalRootPath & "\SMSOSD\OSDLOGS\Install-APPLICATION.log""")
    	
    	if (iRetVal = 0) or (iRetVal = 3010) then
    		ZTIProcess = Success 
    	Else 
    		ZTIProcess = Failure
    		oLogging.CreateEntry "Install-APPLICATION: Error installing Application. Check the log " & oUtility.LocalRootPath & "\SMSOSD\OSDLOGS\Install-APPLICATION.log", LogTypeWarning
    	End If
    
    	' Enable Zone Checks
    	oEnv.Remove("SEE_MASK_NOZONECHECKS")
    
    	oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
    	oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo
    	
    End Function
     
    </script>
    </job>
    

    The template is designed to have the wsf file in the folder that's created when you import an application, then the source files should be in a "Source" folder. Like this:

    To modify the script for use with an .exe instead of a msi installer change the following:

    sSetupFile = oUtility.ScriptDir & "\Source\APPLICATION.exe"
    
    
    iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile & """ " & sArguments)


    If this post is helpful please vote it as Helpful or click Mark for answer.

    Thursday, December 3, 2015 8:33 PM

All replies

  • How are you running this batch file? Did you import it as an application or are you using a run command line task? I have maybe one or two things I still use a batch file for but I converted most of my other batch files into vb scripts. Either way I always import as an application.

    If this post is helpful please vote it as Helpful or click Mark for answer.

    Thursday, December 3, 2015 4:46 PM
  • I created an application using the install string of:

    start "silent_install" /wait silent_install.bat "ODBC,TDNETDP,SQLA"

    or

    silent_install.bat "ODBC,TDNETDP,SQLA"

    The bat file calls the setup.exe file and silently installs the application with the parameters in quotes at the end. The task sequence calls the bat file and I can see if doing its thing but the task sequence is over almost as quick as it started. Since the next task sequence starts the install fails and sometimes the following task sequence will fail. 

    I'm not overly familiar with vbscripts so I was hoping there would be a simpler way to do this. I tried using SMS to have it drop the software into C:\Windows\options and run the bat file from there - hoping that the wait command in SMS would help, but no. 

    Thursday, December 3, 2015 7:17 PM
  • If the batch simply runs an exe then you can use that as the "quiet install command" in your imported application, other wise if you'd like to use a script here's a template.

    <job id="Install-APPLICATION">
    <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
    <script language="VBScript">
     
    ' //***************************************************************************
    ' // Purpose: Template with error logging
    ' // Usage: cscript.exe Install-APPLICATION.wsf [/debug:true]
    ' // Creator: Daniel Vega
    ' // Version: 1.0 - 1/26/2015
    ' // Notes:
    ' //
    ' //***************************************************************************
     
    '//----------------------------------------------------------------------------
    '//
    '// Global constant and variable declarations
    '//
    '//----------------------------------------------------------------------------
     
    Option Explicit
     
    Dim iRetVal
     
    '//----------------------------------------------------------------------------
    '// End declarations
    '//----------------------------------------------------------------------------
     
    '//----------------------------------------------------------------------------
    '// Main routine
    '//----------------------------------------------------------------------------
     
    On Error Resume Next
    iRetVal = ZTIProcess
    ProcessResults iRetVal
    On Error Goto 0
     
    '//---------------------------------------------------------------------------
    '//
    '// Function: ZTIProcess()
    '//
    '// Input: None
    '//
    '// Return: Success - 0
    '// Failure - non-zero
    '//
    '// Purpose: Perform main ZTI processing
    '//
    '//---------------------------------------------------------------------------
    
    Function ZTIProcess()
    
    	Dim sSetupFile
    	Dim sArguments
    
    	sSetupFile = oUtility.ScriptDir & "\Source\APPLICATION.MSI"
    	sArguments = "/switches"
    
    	' Disable Zone Checks
    	oEnv("SEE_MASK_NOZONECHECKS") = 1
    
    	'Install APPLICATION
    
    	oLogging.CreateEntry oUtility.ScriptName & ": Starting installation", LogTypeInfo
    
    	If not oFSO.FileExists(sSetupFile) then
    		oLogging.CreateEntry oUtility.ScriptName & ": " & sSetupFile & " was not found, unable to install", LogTypeError
    		ZTIProcess = Failure
    		Exit Function
    	End if
    
    	iRetVal = oUtility.RunWithHeartbeat("msiexec.exe /i """ & sSetupFile & """ " & sArguments & " /l*v """ & oUtility.LocalRootPath & "\SMSOSD\OSDLOGS\Install-APPLICATION.log""")
    	
    	if (iRetVal = 0) or (iRetVal = 3010) then
    		ZTIProcess = Success 
    	Else 
    		ZTIProcess = Failure
    		oLogging.CreateEntry "Install-APPLICATION: Error installing Application. Check the log " & oUtility.LocalRootPath & "\SMSOSD\OSDLOGS\Install-APPLICATION.log", LogTypeWarning
    	End If
    
    	' Enable Zone Checks
    	oEnv.Remove("SEE_MASK_NOZONECHECKS")
    
    	oLogging.CreateEntry oUtility.ScriptName & ": Return code from command = " & iRetVal, LogTypeInfo
    	oLogging.CreateEntry oUtility.ScriptName & ": Finished installation", LogTypeInfo
    	
    End Function
     
    </script>
    </job>
    

    The template is designed to have the wsf file in the folder that's created when you import an application, then the source files should be in a "Source" folder. Like this:

    To modify the script for use with an .exe instead of a msi installer change the following:

    sSetupFile = oUtility.ScriptDir & "\Source\APPLICATION.exe"
    
    
    iRetVal = oUtility.RunWithHeartbeat("""" & sSetupFile & """ " & sArguments)


    If this post is helpful please vote it as Helpful or click Mark for answer.

    Thursday, December 3, 2015 8:33 PM