Skip to content

Task Sequence - Vbscript to install software

Featured Replies

Hi,

 

I have created program packages in SCCM. Half of these software are the easy *.msi install. However some some are different - means.. running a vbscript to install. The problem is TS doesnt seem to run the VB script specified. (eg. cscript.exe vbscriipt.vbs) nor adding a registry key value (eg. regedit /s registry.reg).

 

cheers

ej

  • 2 weeks later...
  • Author

i had similar issues with this ... are you using run command line or install software?

 

we use run command line

 

e.g. cscript.exe //nologo c:\local\app.vbs

 

Hi jamitupya,

 

I have tried both ways.

Created a package and used Install Software TS - did not work.

Created a Run Command Line TS - failed also...

 

i have done some manual testing to prove that the syntax i have used works.

Hi jamitupya,

 

I have tried both ways.

Created a package and used Install Software TS - did not work.

Created a Run Command Line TS - failed also...

 

i have done some manual testing to prove that the syntax i have used works.

 

 

 

what does your log say when it fails?

 

make a test application in a batch file and test that to see if the install mechanism is working in general.

 

can you post a the logs?

  • Author

what does your log say when it fails?

 

make a test application in a batch file and test that to see if the install mechanism is working in general.

 

can you post a the logs?

 

Did you say .. you HAD this issue? does that mean you've fixed it?

 

i will post the logs shortly

  • 2 weeks later...

There is another way of doing this in your task sequence and it may work better.

 

Create a wsf script named Software.wsf

 

<job id="Software">
<script language="VBScript" src="ZTIUtility.vbs"/>
<script language="VBScript">
'//----------------------------------------------------------------------------
'//
'//  Global constant and variable declarations
'//
'//----------------------------------------------------------------------------
Option Explicit
Dim iRetVal

Dim sSoftInstallFolder
Dim sFile
DIM sScriptRoot
Dim env

Set env = CreateObject("Microsoft.SMS.TSEnvironment")

sScriptRoot = env("ScriptRoot")

sSoftInstallFolder = "c:\windows\temp\"

'//----------------------------------------------------------------------------
'//  End declarations
'//----------------------------------------------------------------------------

'//----------------------------------------------------------------------------
'//  Main routine
'//----------------------------------------------------------------------------
On Error Resume Next
iRetVal = ZTIProcess
ProcessResults iRetVal
On Error Goto 0

Function ZTIProcess()

On Error Resume Next

    iRetVal = Success

    ZTIProcess = iRetval
'//----------------------------------------------------------------------------
'//  Copy Post script to disk, Update RunOnce and change login settings.
'//----------------------------------------------------------------------------
       For Each sFile in Array("Install.vbs")
           If oFSO.FileExists(sScriptRoot & "\" & sFile) then
               oLogging.CreateEntry "Copying " & sScriptRoot & "\" & sFile & " to " & sSoftInstallFolder & sFile, LogTypeInfo
               oFSO.CopyFile sScriptRoot & "\" & sFile, sSoftInstallFolder & sFile, true
           Else
               oLogging.CreateEntry "Unable to copy script " & sFile & " from " & sScriptRoot & " because it does not exist.", LogTypeInfo
           End If
       Next   
       oLogging.CreateEntry oUtility.ScriptName & " COMPLETED.  Return Value = " & iRetVal, LogTypeInfo
End Function

</script>
</job> 

 

Than Create a vbs file named Install.vbs

 

Set oShell = CreateObject("WScript.Shell")
Set oFso = CreateObject("Scripting.FileSystemObject")

If oFso.FileExists("C:\MySoftwareInstaller.exe") Then
       oShell.Run "C:\MySoftwareInstaller.exe /s",0,true
End If

 

 

Place bolth files in your MDT Toolkit Scripts folder.

 

 

In your TS use the toolkit

run command line: cscript.exe "%ScriptRoot%\Software.wsf"

 

 

 

 

This is one way of modifying the script and idea documented here:

http://kongkuba1.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&_c=BlogPart&partqs=cat%3dDrivers

yeah we had this issue but we resolved this a long time ago. i do know we had heaps of issues with pushing software out during OSD, the only way we ever got it to work was with the cscript.exe //nologo c:\<fullpath>\script.vbs

 

we did a whole heap of things in the mean time so i will have to go back through the change management to look it up.. will do on tuesday when back in office.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.