我有下面的PowerShell腳本找出所有不同的BizTalk狀態:查找運行服務實例的BizTalk應用程序的不同狀態
- 實例運行準備
- 活動實例
- 脫水實例
- 斷點處的實例
- 掛起的編排
- 掛起的消息 個
- 路由故障
- 隔離適配器故障
PowerShell腳本
# SQL Settings
$BTSSQLInstance = get-wmiobject MSBTS_GroupSetting -namespace root\MicrosoftBizTalkServer | select-object -expand MgmtDbServerName
$BizTalkManagementDb = get-wmiobject MSBTS_GroupSetting -namespace root\MicrosoftBizTalkServer | select-object -expand MgmtDbName
# Connect the BizTalk Management database
[void] [System.reflection.Assembly]::LoadWithPartialName("Microsoft.BizTalk.ExplorerOM")
$BTSCatalog = New-Object Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer
$BTSCatalog.ConnectionString = "SERVER=$BTSSQLInstance;DATABASE=$BizTalkManagementDb;Integrated Security=SSPI"
# Get BizTalk Service Instance Information
[ARRAY]$readyToRun = get-wmiobject MSBTS_ServiceInstance -namespace 'root\MicrosoftBizTalkServer' -filter '(ServiceStatus = 1)' -ErrorAction SilentlyContinue
[ARRAY]$active = get-wmiobject MSBTS_ServiceInstance -namespace 'root\MicrosoftBizTalkServer' -filter '(ServiceStatus = 2) and not(ServiceClass = 16)' -ErrorAction SilentlyContinue
[ARRAY]$dehydrated = get-wmiobject MSBTS_ServiceInstance -namespace 'root\MicrosoftBizTalkServer' -filter '(ServiceStatus = 8)' -ErrorAction SilentlyContinue
[ARRAY]$breakpoint = get-wmiobject MSBTS_ServiceInstance -namespace 'root\MicrosoftBizTalkServer' -filter '(ServiceStatus = 64)' -ErrorAction SilentlyContinue
[ARRAY]$suspendedOrchs = get-wmiobject MSBTS_ServiceInstance -namespace 'root\MicrosoftBizTalkServer' -filter '(ServiceClass = 1) and (ServiceStatus = 4 or ServiceStatus = 32)' -ErrorAction SilentlyContinue
[ARRAY]$suspendedMessages = get-wmiobject MSBTS_ServiceInstance -namespace 'root\MicrosoftBizTalkServer' -filter '(ServiceClass = 4) and (ServiceStatus = 4 or ServiceStatus = 32)' -ErrorAction SilentlyContinue
[ARRAY]$suspendedRouting = get-wmiobject MSBTS_ServiceInstance -namespace 'root\MicrosoftBizTalkServer' -filter '(ServiceClass = 64)' -ErrorAction SilentlyContinue
[ARRAY]$suspendedIsolated = get-wmiobject MSBTS_ServiceInstance -namespace 'root\MicrosoftBizTalkServer' -filter '(ServiceClass = 32) and (ServiceStatus = 4 or ServiceStatus = 32)' -ErrorAction SilentlyContinue
# Display BizTalk Service Instance Information
Write-Host "`nService Instance Information" -fore DarkGray
Write-Host "Instances Ready to Run:" $readyToRun.Count
Write-Host "Active Instances:" $active.Count
Write-Host "Dehydrated Instances:" $dehydrated.Count
Write-Host "Instances in Breakpoint:" $breakpoint.Count
Write-Host "Suspended Orchestrations:" $suspendedOrchs.count
Write-Host "Suspended Messages:" $suspendedMessages.count
Write-Host "Routing Failures:" $suspendedRouting.count
Write-Host "Isolated Adapter Failures:" $suspendedIsolated.count
是否有任何WMI對象來連接運行實例的BizTalk應用程序相關的活動?
和Application name = Microsoft.Practices.ESB
一樣,有多少個活動的運行實例?如果它不止20次向我發送電子郵件通知。
請告訴我如何使用PowerShell實現功能,我也看到MSBTS_ServiceInstance wmiobject不提供BizTalk應用程序屬性。
參考 - BizTalk Server Health Check PowerShell Script
你問了一個問題,然後有人給你指出了正確的方向。與其接受他/她的回答,你創造了自己的答案,然後接受了答案。對不起,但我會做我能做的事:投票你的答案,並投票正確的。 – Zee
呦!首先,在我放置劇本之前,先標記他的答案。後來他或某人刪除了這個答案,所以我標記了我自己的答案,指出其他問題已經解決。無論如何,我不會爲任何積分或任何狀態而戰。祝你好運!謝謝 –
@Zee也看看兩個腳本之間有什麼不同,感覺不同。 –