複数のサーバーでサービスをチェック/開始/停止できるWindowsフォームアプリを作成しようとしています。ローカルマシンでサービスをチェックするようにコードを設定しましたが、リモートマシンをチェックする方法がわかりません。
try
{
ServiceController machsmint = new ServiceController();
machsmint.ServiceName = "MACHSMIntegration";
if (machsmint.Status.ToString().ToLower() == "stopped")
{
label_machsmINTSTATUS.Text = "Service is not Running";
}
if (machsmint.Status.ToString().ToLower() == "running")
{
label_machsmINTSTATUS.Text = "Service is Running";
}
}
catch
{
label_machsmINTSTATUS.Text = "Service is not Running";
}
リモートマシンに接続するためにコードをどこに追加する必要がありますか、それともここで完全に間違った方向に進んでいますか?これがばかげた質問でしたらごめんなさい!ありがとう!