question

AbhishekReddy-5190 avatar image
0 Votes"
AbhishekReddy-5190 asked AbhishekReddy-5190 commented

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

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 
 }


biztalk-server
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ColinDijkgraaf avatar image
1 Vote"
ColinDijkgraaf answered cngtychngthmAZClear-1778 Suspended commented

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
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Can you please kindly help me with the code snippet ?

0 Votes 0 ·