Vb.net LDAP身份验证未指定错误0x80005000

Vb.net LDAP身份验证未指定错误0x80005000,vb.net,authentication,ldap,directoryentry,Vb.net,Authentication,Ldap,Directoryentry,这是我代码的要点 Public Sub GetADUserList(ByVal ADLoc As String, ByVal vLock As Boolean, ByVal vDays As Integer, ByVal move As Boolean, ByVal vMoveFolder As String, ByVal server As String, resultFile As String) Dim entry As New DirectoryServices.Director

这是我代码的要点

Public Sub GetADUserList(ByVal ADLoc As String, ByVal vLock As Boolean, ByVal vDays As Integer, ByVal move As Boolean, ByVal vMoveFolder As String, ByVal server As String, resultFile As String)
    Dim entry As New DirectoryServices.DirectoryEntry("LDAP://" & ADLoc)
    Dim mySearcher As New DirectoryServices.DirectorySearcher(entry)
    mySearcher.PageSize = 1000
    mySearcher.Filter = ("(objectClass=user)")
    For Each resEnt As DirectoryServices.SearchResult In mySearcher.FindAll()
        HandleUser(resEnt, vLock, move, vMoveFolder, resultFile, vDays)
    Next
End Sub

Private Sub HandleUser(resEnt As DirectoryServices.SearchResult, vlock As Boolean, move As Boolean, moveFold As String, resultFile As String, vdays As Integer)
    Dim de As DirectoryServices.DirectoryEntry = resEnt.GetDirectoryEntry()

    ''' a lot of IF Functions that check the properties and make sure I want to work on the current object
    ''' also there are debugging functions..  logging functions etc..  i ommited them because they all work
    de.MoveTo(New DirectoryServices.DirectoryEntry("LDAP://" & logon_Server & "/" & moveFold))
End Sub
我将它构建成一个整洁的Exe,并计划使用Windows任务调度器运行它

我得到的错误0x80005000是针对de.MoveTo行的

但关键是:当我在登录时运行任务调度程序时,它运行得完美无缺,但当我注销并让它自己运行时,它会在那一行给我错误信息

我的想法是,当我创建新的DirectoryEntry对象时,我应该使用一些身份验证,但如果不清楚地写下密码和用户名,我不知道如何进行身份验证。我希望它只使用任务调度器指定的用户的凭据

希望我的问题足够清楚,希望任何人都愿意并且能够帮助我解决这个问题

你好,瓦西里

p、 s.无论用户是否登录,都会选中运行选项。
该程序还做了很多其他事情,比如写入日志文件并获取信息,它只是在需要时拒绝移动对象。

是否添加了Try/Catch块以获取更多错误信息?是的,我添加了。我从exception.Message获得的错误0x80005000请查看并检查建议是否有用。