Score:0

target name is incorrect or the server has rejected the client credentials

us flag

I am trying to run a scheduled task with a user account that only has "domain users" group membership. I can also run the Powershell ISE as this alternate user to simulate this. I am getting the same error. If I run any Active Directory Powershell command like get-aduser or Get-ADDomainController, I get the error: "Either the target name is incorrect or the server has rejected the client credentials." If I specify the argument -server aDomainController.MyDomain.com, then it works. Specifying -server MyDomain.com also does not work. The machine I'm running the command from, my account, and the alternate account are all in the same domain.

Can anyone explain to me what is happening here? Or, how can I make this work? I don't want to specify a domain controller because I want to keep the script generic and also not assume the availability of a particular domain controller. Usually, the Windows authentication process takes care of domain controller selection for us. I don't want to have to build in domain controller discovery into my script just so that I can run it with a read-only account instead of a domain admin.

  • There is no firewall involved.
  • I'm running Windows Server 2019 on my machine, 2012 R2 on the domain controllers.

Edit: this also happens with a domain admin. So, apparently anything other than my logged on account. So, a scheduled task isn't possible if it queries Active Directory? Now, I'm thinking some policy setting is breaking this.

yagmoth555 avatar
cn flag
Hi, in your powershell script I assume you call *import-module activedirectory* at your script start ?
Roman avatar
us flag
No. It is not necessary to use import-module anymore. And, doing so does not make a difference.
Bernd Schwanenmeister avatar
au flag
To keep it generic, use
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.