To get application status on Remote BizTalk server from a non biztalk Machine using powershell

Abhishek Reddy 61 Reputation points
2022-02-23T10:47:59.52+00:00

Hi All

I wanted to write a script which will get the application status details from a remote BizTalk server from a non BizTalk installed machine using Powershell.

Please help!

Currently I am using code pasted under and I am getting nothing from it, as it is looking at local server although I have given Remote server details.enter code here

$servers = ("XXXX")

 function checkhostinstancestatusstarted ($server)
 {

$hostinstances = get-wmiobject MSBTS_HostInstance -namespace 'root\MicrosoftBizTalkServer'  | where {$_.runningserver -match $server -AND $_.hosttype -ne "2" -and $_.IsDisabled -ne    "True"}

write-host "Checking the state of all host instances on the server $server"

foreach ($hostinstance in $hostinstances)
    {
    $HostInstanceName = $HostInstance.hostname

    #Checks the host instance state
    if ($HostInstance.ServiceState -eq 1)
        {
        write-host "$HostInstanceName`: Stopped."
        }
    elseif ($HostInstance.ServiceState -eq 2)
        {
        write-host "$HostInstanceName`: Start pending."
        }
    elseif ($HostInstance.ServiceState -eq 3)
        {
        write-host "$HostInstanceName`: Stop pending."
        }
    elseif ($HostInstance.ServiceState -eq 4)
        {
        write-host "$HostInstanceName`: Started."
        }
    elseif ($HostInstance.ServiceState -eq 5)
        {
        write-host "$HostInstanceName`: Continue pending."
        }
    elseif ($HostInstance.ServiceState -eq 6)
        {
        write-host "$HostInstanceName`: Pause pending."
        }
    elseif ($HostInstance.ServiceState -eq 7)
        {
        write-host "$HostInstanceName`: Paused."
        }
    elseif ($HostInstance.ServiceState -eq 8)
        {
        write-host "$HostInstanceName`: Unknown."
        }
    }
write-host `n    
}

foreach ($server in $servers)
{
checkhostinstancestatusstarted $server 
}
Microsoft BizTalk Server
Microsoft BizTalk Server
A family of Microsoft server products that support large-scale implementation management of enterprise application integration processes.
347 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Colin Dijkgraaf 1,346 Reputation points
    2022-02-27T22:22:24.183+00:00

    You need to update your get-wmiobject MSBTS_HostInstance to connect to the remote server

    Connecting to WMI Remotely with PowerShell

    e.g.

    Get-WmiObject -Namespace "root\cimv2" -Class Win32_Process -Impersonation 3 -ComputerName Computer_B

    1 person found this answer helpful.