ユーザーが AD パスワードを変更できるツールを作成しました。このツールは会社のドメインでは問題なく動作しますが、顧客のマシンで citrix を実行すると、次のエラー メッセージが表示されます。
System.Reflection.TargetInvocationException: 呼び出しのターゲットによって例外がスローされました。---> System.UnauthorizedAccessException: アクセスが拒否されました。(HRESULT からの例外: 0x80070005 (E_ACCESSDENIED)) --- 内部例外スタック トレースの終了 --- System.DirectoryServices.DirectoryEntry.Invoke(String methodName, Object[] args) at System.DirectoryServices.AccountManagement.SDSUtils.ChangePassword( System.DirectoryServices.AccountManagement.ADStoreCtx.ChangePassword(AuthenticablePrincipal p, String oldPassword, String newPassword) の DirectoryEntry de, String oldPassword, String newPassword) CitrixPWChangeBackend.ActiveDirectory.ChangePasswordForCurrentUser(String oldPw, String newPw, Boolean& errorWrongPw, Boolean& errorPasswordRules, String& errorMessage) )
そのエラーの原因となっている行は次のとおりです。
UserPrincipal.Current.ChangePassword(oldPw, newPw);
もちろん、「oldPW」が正しいです。