ローカル コンピューターでユーザーを有効または無効にするために、次のスニペットを使用しています。
DirectoryEntry localMachine = new DirectoryEntry("WinNT://" + Environment.MachineName);
DirectoryEntry currentUser = localMachine.Children.Find(user, "Administrators");
currentUser.Invoke("AccountDisabled", new object[] { true });
currentUser.CommitChanges();
ユーザーを文字列として割り当てています。「ファイルパスが見つかりません」というエラーが表示されます: Comexception Unhandled.
私のコードに何か問題がありますか?