Video Screencast Help
Search Video Help Close Back
to help
New in the Rewards Catalog: Vouchers for "Symantec Technical Specialist" and "Symantec Certified Specialist" exams.

VBScript Subroutine to Launch Altiris DS Job

Updated: 06 Dec 2007
Jason Gallas's picture
0 0 Votes
Login to vote

I wanted a way to launch an Altiris job from a VBScript. After doing some searching online I realized that the axsched.exe command can do this. Here is a subroutine that I created that will launch an Altiris DS job on the system running the VBScript using axsched.exe.

In bold is the actual calling of the Sub that would go in the body of your script. Beware of any quotes in the Deployment Server job names as this will break the vbscript!

This script could be used either in an afterscript on a deployed image to install additional software or could also be called later as a departmental afterscript, installing all the software necessary for a particular department.

Call ScheduleDSJob("job name")

Sub ScheduleDSJob(strJobName)
  
  Dim WshShell, WshNetwork, strDPServer, strDSPath, strComputerName, strTime
  
  Set WshShell = CreateObject("WScript.Shell")
  Set WshNetwork = CreateObject("WScript.Network")

  strDPServer = WshShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Altiris\Client Service\TcpAddr")
  strDSPath = "\\" & strDPServer & "\eXpress\"
  strComputerName = WshNetwork.ComputerName
  strTime = Year(now) & "-" & Month(now) & "-" & Day(now) & " " & FormatDateTime(now, 4)
  
  WshShell.Run strDSPath & "axsched.exe " & strComputerName & " " & chr(34) & strJobName & chr(34) & " /d " & strDPServer & " /t " & chr(34) & strTime & chr(34) & " /y"

  Set WshShell = Nothing
  Set WshNetwork = Nothing

  WScript.Sleep(1000)
  
End Sub