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
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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
}
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