vbscript: Function ExportsPending

A simple function to check if any exports are ending before runing an Export. You can save time and transaction log space if you avoid running jobs which aren’t actually needed.

 

Dim MIIS_Service
Set MIIS_Service = GetObject(“winmgmts:root\MicrosoftIdentityIntegrationServer”)

‘—————————————————–
‘  Function ExportsPending
‘  + Returns TRUE if objects are waiting to be exported
‘—————————————————–

Function ExportsPending(MA)
  Dim ManagementAgent

  Set ManagementAgent = MIIS_Service.Get(“MIIS_ManagementAgent.Name='”& MA &”‘”)

  If (ManagementAgent.numExportAdd() + ManagementAgent.numExportUpdate() + ManagementAgent.numExportDelete()) > 0 Then
    ExportsPending = TRUE
  Else
    ExportsPending = FALSE
  End If
End Function