1

ワークグループ経由でコンピューターに接続しようとしています。私のコードは以下の通りです:

ConnectionOptions options = new ConnectionOptions();
options.Impersonation = ImpersonationLevel.Impersonate;
options.Username = "testusername";
options.Password = "testpwd";
ManagementScope scope = new ManagementScope(@"\\19x.16x.x.xx\C$\TestFolder", options);
scope.Connect();
if (scope.IsConnected == true)
{ 
    MessageBox.Show("Connection Succeeded", "Alert"); 
} 
else 
{
    MessageBox.Show("Connection Failed", "Alert");
}

これを実行すると、「無効なパラメーター」という例外が発生します

これを整理する方法は?

編集:

エラーは次の行にあります。

ManagementScope scope = new ManagementScope(@"\\19x.16x.x.xx\C$\TestFolder", options);

ドライブの指定方法 $ が問題を引き起こしていると思います

4

1 に答える 1