You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scenario: VM is in a workgroup and wants to join an AD domain for the 1st time:
It successfully joins the AD domain, but DSC throws the following error: Exception calling "FindOne" with "0" argument(s): "The user name or password is incorrect."
This is thrown by DirectorySearcher.FindOne() in function Get-ADSIComputer :
I did not investigate the exact reason of the error message "The user name or password is incorrect.", but credentials are valid since VM joins the AD domain successfully.
A possible simple workaround would be to add a try catch:
try
{
return$searcher.FindOne()
}
catch
{
}
Operating system the target node is running
OsName : Microsoft Windows Server 2022 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsVersion : 2009
WindowsBuildLabEx : 20348.1.amd64fre.fe_release.210507-1500
OsLanguage : en-US
OsMuiLanguages : {en-US}
PowerShell version and build the target node is running
Name Version Path
---- ------- ----
ComputerManagementDsc 9.0.0 C:\Program Files\WindowsPowerShell\Modules\ComputerManagementDsc\ComputerManagementDsc.psd1
The text was updated successfully, but these errors were encountered:
Yvand
changed the title
[Computer] Join AD domain succeeds but it throws an error.
[Computer] Join AD domain succeeds but it throws error "The user name or password is incorrect"
Jun 15, 2023
Safer solution might be to pickup username with $Credential.GetNetworkCredential().UserName this will only have the username. and not domain part if this was supplied in the credential object.
Problem description
Scenario: VM is in a workgroup and wants to join an AD domain for the 1st time:
It successfully joins the AD domain, but DSC throws the following error:
Exception calling "FindOne" with "0" argument(s): "The user name or password is incorrect."
This is thrown by
DirectorySearcher.FindOne()
infunction Get-ADSIComputer
:ComputerManagementDsc/source/DSCResources/DSC_Computer/DSC_Computer.psm1
Line 745 in fcff2e0
Verbose logs
DSC configuration
Suggested solution
I did not investigate the exact reason of the error message "The user name or password is incorrect.", but credentials are valid since VM joins the AD domain successfully.
A possible simple workaround would be to add a try catch:
Operating system the target node is running
PowerShell version and build the target node is running
ComputerManagementDsc version
The text was updated successfully, but these errors were encountered: