Video Screencast Help
Endpoint Management Community Blog

VBScript Subroutine to Launch Altiris DS Job

Created: 05 Dec 2007 • Updated: 06 Dec 2007 • 1 comment
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

Comments 1 CommentJump to latest comment

mapache's picture

Hi,

Very nice script ;)

Question:
If i want to install 3 different jobs and reboot only at the end, do you know a way to do it?

Many thanks,
Mapache

+5
Login to vote