none
Use Batch File to Install Ninite in MDT Task Sequence RRS feed

  • Question

  • I am trying to use a batch file to call a Ninite.exe which will install some programs in that same batch file I need to start a timer for about 15 to 20 minutes so everything can download and install on the machine. Then I have to run a taskkill on ninite.exe so the task sequence does not get hung up. This is what I am using right now.

    Start Call "\\10.1.1.143\GoldenImage\Ninite.exe"

    TIMEOUT /t 1200 /NOBREAK

    TASKKILL /F /IM ninite.exe

    This works but it opens another cmd window via the start command. If I take start out the TIMEOUT command does not start until I manually close ninite after it finishes. Any suggestions or help on this?

    Wednesday, April 11, 2018 9:54 PM

All replies

  • Import it as an application into MDT. Use a VBscript or PowerShell wrapper.

    I myself use PatchMyPC and here's what my wrapper looks like. It works fine for me because PMP doesn't exit until it's done installing/patching all the apps. If you only deploy 64bit systems you can eliminate the logic for architecture. 

    <job id="Run-PatchMyPC">
    <script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
    <script language="VBScript"> 
    
    '//----------------------------------------------------------------------------
    '// Purpose: Used to run Patch My PC
    '// Usage: cscript Run-PatchMyPC.wsf [/debug:true]
    '// Version: 3.0 - February 26, 2018 - Daniel Vega
    '// Notes: Added configuration files to folder and task scheduler settings
    
    '//----------------------------------------------------------------------------
    
    '//----------------------------------------------------------------------------
    '// 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\*.*"
    sArguments = "/s"
    
    
    ' Disable Zone Checks
    oEnv("SEE_MASK_NOZONECHECKS") = 1
    
    ' Create folder if it doesn't exist
    If oEnvironment.Item("Architecture") = "X86"  then 
    	oLogging.CreateEntry oUtility.ScriptName & ": Running on 32bit OS", LogTypeInfo
    	If not oFSO.FolderExists(oENV("ProgramFiles") & "\Patch My PC") Then
    	oFSO.CreateFolder oENV("ProgramFiles") & "\Patch My PC"
    	ElseIf oFSO.FolderExists(oENV("ProgramFiles") & "\Patch My PC") Then
    	End If
    Else
    	oLogging.CreateEntry oUtility.ScriptName & ": Running on 64bit OS", LogTypeInfo
    	If not oFSO.FolderExists(oENV("ProgramFiles(x86)") & "\Patch My PC") Then
    	oFSO.CreateFolder oENV("ProgramFiles(x86)") & "\Patch My PC"
    	ElseIf oFSO.FolderExists(oENV("ProgramFiles(x86)") & "\Patch My PC") Then
    	End If
    End If
    
    ' Run Patch My PC
    oLogging.CreateEntry "Run-PatchMyPC: Starting Patch My PC", LogTypeInfo
    
    If oEnvironment.Item("Architecture") = "X86"  then
    	oFSO.CopyFile sSetupFile, oENV("ProgramFiles") & "\Patch My PC\", True
    	oUtility.RunWithHeartbeat(oENV("ProgramFiles") & "\Patch My PC\PatchMyPC.exe " & sArguments)
    	oLogging.CreateEntry oUtility.ScriptName & ": Creating Scheduled Task to run Patch My PC daily", LogTypeInfo
    	oUtility.RunWithHeartbeat("schtasks.exe /Create /TN ""Patch My PC"" /XML """ & oENV("ProgramFiles") & "\Patch My PC\PatchMyPCx86.xml"" /F")
    Else
    	oFSO.CopyFile sSetupFile, oENV("ProgramFiles(x86)") & "\Patch My PC\", True
    	oUtility.RunWithHeartbeat(oENV("ProgramFiles(x86)") & "\Patch My PC\PatchMyPC.exe " & sArguments)
    	oLogging.CreateEntry oUtility.ScriptName & ": Creating Scheduled Task to run Patch My PC daily", LogTypeInfo
    	oUtility.RunWithHeartbeat("schtasks.exe /Create /TN ""Patch My PC"" /XML """ & oENV("ProgramFiles(x86)") & "\Patch My PC\Patch My PC.xml"" /F")
    End If
    
    If (iRetVal = 0) or (iRetVal = 3010) then
    	ZTIProcess = Success 
    Else 
    	ZTIProcess = Failure
    	oLogging.CreateEntry "Run-PatchMyPC: Error installing Patch My PC. Check the log " & oUtility.LocalRootPath & "\SMSOSD\OSDLOGS\Run-PatchMyPC.log", LogTypeWarning
    End If
    
    
    ' Enable Zone Checks
    oEnv.Remove("SEE_MASK_NOZONECHECKS")
    
    oLogging.CreateEntry "Run-PatchMyPC: Finished Patch My PC", LogTypeInfo	
    
    End Function 
    
    </script>
    </job>


    Daniel Vega

    Thursday, April 12, 2018 1:55 PM