When scheduling runs with multiple Lotus Notes Management Agents in MIIS, you need to be careful because you can't run more then one Notes MA at a time.
When you try to run the second ma, it will fail throwing an error.
This can be a pretty annoying problem when you have to run multiple Notes MA's on a
different scheduling interval.
I came up with a quick way to check if there were any other Notes MA's running using WMI and VB.net
This way instead of the second Notes MA failing, it would just wait until the other Notes MA was finished.
Here's the code snippet:
Imports Microsoft.win32
Imports System.Xml
Imports System.IO.Directory
Imports System.IO
Module NotesMAStatus
Sub Main(ByVal args() As String)
Dim Service = GetObject("winmgmts:root\MicrosoftIdentityIntegrationServer")
Dim ManagementAgents = Service.ExecQuery("select * from MIIS_ManagementAgent")
Dim MA
Dim maName
Dim MARunning As Boolean = True
Do While MARunning = True
MARunning = False
For Each MA In ManagementAgents
If MA.Type.ToString.ToLower = "lotus notes" Then
'Console.WriteLine("")
'Console.WriteLine(MA.Name)
'Console.WriteLine(MA.Guid)
Dim ManagementAgent = Service.Get("MIIS_ManagementAgent.Name='" + MA.Name + "'")
Dim test = ManagementAgent.RunStatus(MA.Guid)
'Console.WriteLine(test)
Console.WriteLine("")
If test = "in-progress" Then
MARunning = True
Console.WriteLine("")
Console.WriteLine(MA.Name + " is Running")
Console.WriteLine("")
End If
End If
Next
If MARunning = True Then
System.Threading.Thread.Sleep(10000)
End If
Loop
End Sub
End Module
Tuesday, May 01, 2007
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment