VB.NETを使用してActiveDirectoryに新しいユーザーを作成するページがあります次のコードを使用しています
Dim rootEntry As New DirectoryEntry
With rootEntry
.Path = "LDAP://" & strServer & "/" & strLDAP
.AuthenticationType = AuthenticationTypes.Secure
.Username = strServerUsername
.Password = strServerPassword
End With
Dim newUser As DirectoryEntry = rootEntry.Children.Add("CN=" & strCN, "user")
With newUser
.CommitChanges()
.Properties("userPrincipalName").Value = TextPN.Text
.Properties("sAMAccountName").Value = TextAlias.Text
.Properties("givenname").Value = TextGivenname.Text
.Properties("sn").Value = TextSurname.Text
……
.CommitChanges()
.Invoke("setPassword", New Object() {strDefaultPassword})
.CommitChanges()
.Properties("userAccountControl").Value = &H0001
.CommitChanges()
End With
このコードは過去に正常に機能していました。これで、WebサーバーをWindows Server 2008R2およびIIS7.5に移行しましたが、突然コードが機能しなくなりました。(.net Frameworkは2.0であり、変更できません)ユーザーは引き続きActive Directoryに作成されますが、アカウントは自動的に無効になり、パスワードは設定されません。
この問題を調査すると、例外が回線でスローされていることがわかります
.Invoke("setPassword", New Object() {strDefaultPassword})
例外
The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
ADへの接続に使用されるユーザーアカウントは同じであり、ドメイン管理者権限があります。コードに何も変更されていないので、これが機能しなくなった別の理由があるに違いないと思いますか?ファイアウォール設定、IIS構成、..?
何か案は??
ここにも同様のケースがあることを知っています。新しいActiveDirectoryユーザーを作成しようとすると、Invoke( "SetPassword"、pwd)は "RPCサーバーが利用できません"をスローしますが 、これは役に立ちません。