VBScript function to run profile “Profile” for management agent “MA”.
Â
‘—————————————————–
‘Â Function RunProfile
‘Â + Run a MA run profile
‘Â + Returns 0 for success
‘—————————————————–Function RunProfile(MA, Profile)
 Dim ManagementAgent, Status
 Dim runDetails, runResults
 Dim xmlDoc, x
 Dim iStart, iEnd
 Dim numUpdates, numAdds, numDeletes If MA = “” then Exit Function
 WriteLog “Running ” & MA & ” ” & Profile
 Set ManagementAgent = MIIS_Service.Get(“MIIS_ManagementAgent.Name='”& MA &”‘”) Status = ManagementAgent.Execute(Profile)
 WriteLog MA & “, ” & Profile & ” ” & ManagementAgent.RunStatus If Status = “success” thenÂ
   RunProfile = 0   runDetails = ManagementAgent.RunDetails
   iStart = InStr(runDetails, “<staging-counters>”)
   iEnd = InStr(runDetails, “</staging-counters>”)
   runDetails = Mid(runDetails, iStart, (iEnd+19) – iStart)   Set xmlDoc = CreateObject(“Microsoft.XMLDOM”)
   xmlDoc.async=”false”
   xmlDoc.loadXML(runDetails)   For Each x in xmlDoc.documentElement.childNodes
     runResults = runResults & Mid(x.nodename,7) & “: ” & x.text & “, ”
   Next   WriteLog runResults
 Else
   RunProfile = -1
 End ifEnd Function
Â