What is a VBScript example of how to use the ASDK's RegisterExternalApp and CreateJobScheduleByName?
| Article:HOWTO26011 | | | Created: 2010-04-20 | | | Updated: 2010-04-20 | | | Article URL http://www.symantec.com/docs/HOWTO26011 |
Question
What is an example of how to use the ASDK's RegisterExternalApp and CreateJobScheduleByName?
Answer
Wscript.StdOut.WriteLine("Setting up variables.")
server = "DS Computer Name"
domain = "Your Domain"
username = "username"
password = "password"
jobName = "TestJob"
computerName = "WinXPClient01"
myAppName = "myAppName"
appDescription = "myAppDescription"
appLocation = "myAppLocation"
Wscript.StdOut.WriteLine("Creating Altiris.ASDK.DS.JobManagement object.")
Set jobManagement = CreateObject("Altiris.ASDK.DS.JobManagement")
Wscript.StdOut.WriteLine("Creating Altiris.ASDK.DS.ScheduleManagement object.")
Set scheduleManagement = CreateObject("Altiris.ASDK.DS.ScheduleManagement")
Wscript.StdOut.WriteLine("Attempting .Net Authentication for jobManagement")
jobManagement.TargetServer = server
jobManagement.UserName = username
jobManagement.Password = password
jobManagement.DomainName = domain
jobManagement.Authenticate()
Wscript.StdOut.WriteLine("Attempting .Net Authentication for scheduleManagement.")
scheduleManagement.TargetServer = server
scheduleManagement.UserName = username
scheduleManagement.Password = password
scheduleManagement.DomainName = domain
scheduleManagement.Authenticate()
'-----------------------------------------
' DSAuthenticate
' This is the authentication passed to
' the DS DB Management Service
'-----------------------------------------
Wscript.StdOut.WriteLine("Attempting DSAuthentication for jobManagement.")
call jobManagement.DSAuthenticate(username, password, domain) 'username,password,domain
Wscript.StdOut.WriteLine("Attempting DSAuthentication for scheduleManagement.")
call scheduleManagement.DSAuthenticate(username, password, domain) 'username,password,domain
'-----------------------------------------
' GetComputerInfo computerID
'-----------------------------------------
Wscript.StdOut.WriteLine("Calling jobManagement.GetJobIDs")
jobList = jobManagement.GetJobIDs(jobName)
tempJobID = jobList(0) ' use the only element that comes back from the function. This will error if there is
Wscript.StdOut.WriteLine("JobIDFound for " & jobName & ": " & tempJobID)
myAppID = scheduleManagement.RegisterExternalApp(myAppName, appDescription, appLocation, false)
scheduleID = scheduleManagement.CreateJobScheduleByName(computerName, tempJobID, false, myAppName, _
"<ScheduleAttributes xmlns=""http://tempuri.org/ScheduleAttributes.xsd"">" & vbcrlf & _
"<Schedule_Attribute_Table>" & vbcrlf & _
" <start_time>" & Now() & "</start_time>" & vbcrlf & _
" <defer_time>0</defer_time>" & vbcrlf & _
" <recurrence_value>1</recurrence_value>" & vbcrlf & _
" <recurrence_type>Hours</recurrence_type>" & vbcrlf & _
" <batch_size>0</batch_size>" & vbcrlf & _
" <batch_interval>0</batch_interval>" & vbcrlf & _
" </Schedule_Attribute_Table>" & vbcrlf & _
"</ScheduleAttributes>")
Legacy ID
52503
Article URL http://www.symantec.com/docs/HOWTO26011
Terms of use for this information are found in Legal Notices









Thank you.