<Task ID="Microsoft.Unix.EnumerateAvailableAgents.Task" Accessibility="Public" Enabled="true" Target="SC!Microsoft.SystemCenter.ManagementServer" Timeout="300" Remotable="true">
<Category>Custom</Category>
<WriteAction ID="WA" TypeID="Windows!Microsoft.Windows.ScriptWriteAction">
<ScriptName>EnumerateAvailableAgents.vbs</ScriptName>
<Arguments/>
<ScriptBody><Script>
'
' Copyright (c) Microsoft Corporation. All rights reserved.
'
Option Explicit
Dim oFso, RootFolder, s
Dim Agent, Agents
Dim OMInstallFolder, AgentFolder
Dim WshShell, AgentPath
' Get Install Directory from Registry
Set WshShell = WScript.CreateObject("WScript.Shell")
OMInstallFolder = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Setup\InstallDirectory")
AgentFolder = OMINstallFolder & "AgentManagement\UnixAgents"
' Create File System object
Set oFso = CreateObject("Scripting.FileSystemObject")
' Check if UnixAgent folder exists
If (oFso.FolderExists(AgentFolder)) Then
' Set folder to UnixAgent Folder
Set RootFolder = oFso.GetFolder(AgentFolder)
Set Agents = RootFolder.Files
s = "<SupportedAgents>"
s = s & "<Path>" & RootFolder & "</Path>"
For Each Agent in Agents
' Get Agents
s = s & "<Agent>" & Agent.Name & "</Agent>"
Next
s = s & "</SupportedAgents>"
' Return XML Results
WScript.Echo s
Else
s = "<SupportedAgents/>"
WScript.Echo s
End If </Script></ScriptBody>
<TimeoutSeconds>60</TimeoutSeconds>
</WriteAction>
</Task>