我正在尝试查询 BizTalkMgmtDB 数据库以获取主机实例及其状态的列表。我在哪里可以找到其当前状态,即正在运行、已停止和不适用
SELECT
h.Name AS HostInstanceName,
CASE
WHEN h.HostType = 1 THEN 'In-Process'
WHEN h.HostType = 2 THEN 'Isolated'
ELSE 'Unknown'
END AS HostType,
s.Name AS ServerName,
CASE
WHEN hi.DisableHostInstance = -1 THEN 'Yes'
WHEN hi.DisableHostInstance = 0 THEN ''
ELSE 'Unknown'
END AS IsDisabled
FROM
adm_HostInstance hi
JOIN
adm_Server2HostMapping shm ON hi.Svr2HostMappingId = shm.Id
JOIN
adm_Host h ON shm.HostId = h.Id
JOIN
adm_Server s ON shm.ServerId = s.Id
ORDER BY
HostInstanceName;
我没有找到任何可能代表此状态的列
我认为使用 WMI 脚本比直接 SQL 查询数据库更好。以下是获取所有正在运行的主机实例的方法:
gwmi MSBTS_HostInstance -namespace 'root\MicrosoftBizTalkServer' | WHERE {$_.ServiceState -eq 4 }
并获取所有已停止的主机实例:
gwmi MSBTS_HostInstance -namespace 'root\MicrosoftBizTalkServer' | WHERE {$_.ServiceState -eq 1 }