' We cannot build these strings in the script as they are template-replaced by SCOM/MPSeal
const CLASS_BROWSERENG = "$MPElement[Name='Microsoft.FASTSearch.MP.Entity.BrowserEngine']$"
const CLASS_SAMADMIN = "$MPElement[Name='Microsoft.FASTSearch.MP.Entity.SAMAdmin']$"
const CLASS_SAMWORKER = "$MPElement[Name='Microsoft.FASTSearch.MP.Entity.SAMWorker']$"
const CLASS_QRPROXY = "$MPElement[Name='Microsoft.FASTSearch.MP.Entity.QRProxy']$"
Dim oAPI, oDiscoveryData, oInst
Set oAPI = CreateObject("MOM.ScriptAPI")
set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)
Dim WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")
Const SetupKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\FAST Search Server\Setup\"
Dim strPath, isPSConfigured
strPath = WSHShell.RegRead(SetupKey & "Path")
isPSConfigured = WSHShell.RegRead(SetupKey & "PSConfigured")
If (strPath <> "") And isPSConfigured Then
'-------------------------------------------------------------------------
' NCTRL SERVICES
Dim xmlDoc
Set xmlDoc = CreateObject("Msxml2.DOMDocument")
xmlDoc.load(strPath & "\etc\NodeConf.xml")
' This implementation is limited, in that nodeconf.xml supports multiple
' nodes to be configured in the same file. However, the FS14 setup team
' has promised that nodeconf.xml will contain only one node for FS14.
Dim firstNode
Set firstNode = xmlDoc.selectSingleNode("nodes/node")
Dim procList
Set procList = firstNode.selectNodes("global/startorder/proc")
Dim procListLength
procListLength = procList.Length
Dim node
For Each node In procList
Dim strProcName
strProcName = node.text
If (strProcName = PROCID_BROWSERENG) Then AddService strProcName, CLASS_BROWSERENG, SRVNAME_BROWSERENG, SRVDESC_BROWSERENG
If (strProcName = PROCID_SAMADMIN ) Then AddService strProcName, CLASS_SAMADMIN, SRVNAME_SAMADMIN, SRVDESC_SAMADMIN
If (strProcName = PROCID_SAMWORKER ) Then AddService strProcName, CLASS_SAMWORKER, SRVNAME_SAMWORKER, SRVDESC_SAMWORKER
If (strProcName = PROCID_QRPROXY ) Then AddService strProcName, CLASS_QRPROXY, SRVNAME_QRPROXY, SRVDESC_QRPROXY
Next
'-------------------------------------------------------------------------
' ADMIN SERVICES
Dim oExec
Set oExec = WSHShell.Exec("%WINDIR%\system32\inetsrv\appcmd.exe LIST SITE """ & ADMINSERVICES_SITENAME & """")
If Err.Number = 0 Then
Do While oExec.Status = 0
WScript.Sleep 100
Loop
If oExec.ExitCode = 0 Then
AddInstance "$MPElement[Name='Microsoft.FASTSearch.MP.Entity.AdminServices']$", "AdminServices"
AddInstance "$MPElement[Name='Microsoft.FASTSearch.MP.Entity.FarmWatcher']$", "FarmWatcher"
End If
End If
End If