Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

remote WMI execution

6 views
Skip to first unread message

AV

unread,
Apr 17, 2008, 5:12:00 AM4/17/08
to
Hi,

I am writing a win application which can monitor the status of BizTalk
HostInstances across all the environments. I plan to host this winapp onto a
centralized server within the same domain as my BizTalk servers are for
different environments.

I am unable to get the HostInstances's name from a remote biztalk server in
the same domain whereas it works fine for a local one. Below is the peice of
code which I am executing to get the HostInstance names.

CODE
---------------
ConnectionOptions _conOpt = new ConnectionOptions();
_conOpt.Impersonation = ImpersonationLevel.Impersonate;
_conOpt.Authentication = AuthenticationLevel.Default;
_conOpt.EnablePrivileges = true;

_conOpt.Username = @"MYDOMAIN\myadminusername";
_conOpt.Password = "mypassword";

EnumerationOptions _enumOpt = new EnumerationOptions();

ManagementScope _mgmtScope = new ManagementScope();
_mgmtScope.Path = new
ManagementPath("\\\\my.remote.biztalkservername\\ROOT\\MICROSOFTBIZTALKSERVER");
_mgmtScope.Options = _conOpt;

try
{
_mgmtScope.Connect();

ManagementObjectSearcher _mgmtObjSrch = new
ManagementObjectSearcher(_mgmtScope, new ObjectQuery("SELECT * FROM
MSBTS_HostInstance"));
ManagementObjectCollection _mgmtObjCol = _mgmtObjSrch.Get();

foreach (ManagementObject _hiObj in _mgmtObjCol)
{
string _strTemp =
_hiObj.Properties["Name"].Value.ToString();
DialogResult _diagRes = MessageBox.Show(_strTemp + " YOU
WISH TO STOP THIS SERVICE ??", "UserOption", MessageBoxButtons.YesNo);
if (_diagRes.Equals(DialogResult.Yes))
{
_hiObj.InvokeMethod("Stop", null);
}
}
}
catch (Exception ex)
{

MessageBox.Show(ex.Message,"ERROR",MessageBoxButtons.OK,MessageBoxIcon.Error);
}

The following error is returned when trying to retreive the HostInstance
name from a remote BizTalk server.

ERROR
---------------------------
BizTalk Server cannot access SQL server. This could be due to one of the
following reasons:
1. Access permissions have been denied to the current user. Either log on
as a user that has been granted permissions to SQL and try again, or grant
the current user permission to access SQL Server.
2. The SQL Server does not exist or an invalid database name has been
specified. Check the name entered for the SQL Server and database to make
sure they are correct as provided during SQL Server installation.
3. The SQL Server exists, but is not currently running. Use the Windows
Service Control Manager or SQL Enterprise Manager to start SQL Server, and
try again.
4. A SQL database file with the same name as the specified database already
exists in the Microsoft SQL Server data folder.

Internal error from OLEDB provider: "Login failed for user 'NT
AUTHORITY\ANONYMOUS LOGON'."


Please help !!

Tks,

0 new messages