[Computer] Join AD domain succeeds but it throws error "The user name or password is incorrect"
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 38/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- powershell
調査の方向性
source/DSCResources/DSC_Computer/DSC_Computer.psm1 の、745 行目付近にある関数 Get-ADSIComputer と DirectorySearcher.FindOne() の呼び出しから始めます。提供された Windows Server、PowerShell、ComputerManagementDsc のバージョンを使用して、初回のドメイン参加シナリオを再現します。その後、参加に成功しても資格情報エラーが発生しないこと、およびリソースが完了状態を正しく報告することを確認します。
索引モデルが issue の本文から書いたものです。
説明
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() in function Get-ADSIComputer : https://github.com/dsccommunity/ComputerManagementDsc/blob/fcff2e040bf8162f8138eb08612fde3e3c60ef42/source/DSCResources/DSC_Computer/DSC_Computer.psm1#L745
Verbose logs
VERBOSE: [2023-06-15 08:29:26Z] [VERBOSE] [SP]: LCM: [ Start Set ] [[Computer]JoinDomain]
VERBOSE: [2023-06-15 08:29:26Z] [VERBOSE] [SP]: [[Computer]JoinDomain] Setting computer
state for 'SP'.
VERBOSE: [2023-06-15 08:29:26Z] [VERBOSE] [SP]: [[Computer]JoinDomain] Perform operation
'Enumerate CimInstances' with following parameters, ''namespaceName' = root\cimv2,'className' = Win32_ComputerSystem'.
VERBOSE: [2023-06-15 08:29:26Z] [VERBOSE] [SP]: [[Computer]JoinDomain] Operation 'Enumerate CimInstances' complete.
VERBOSE: [2023-06-15 08:29:29Z] [ERROR] Exception calling "FindOne" with "0" argument(s): "The user name or password is incorrect."
VERBOSE: [2023-06-15 08:29:30Z] [WARNING] [SP]: [[Computer]JoinDomain] The changes will take effect after you restart the computer SP.
VERBOSE: [2023-06-15 08:29:30Z] [VERBOSE] [SP]: [[Computer]JoinDomain] Added computer to domain 'contoso.local'.
VERBOSE: [2023-06-15 08:29:30Z] [VERBOSE] [SP]: LCM: [ End Set ] [[Computer]JoinDomain] in 3.8950 seconds.
DSC configuration
configuration ConfigureSQLVM
{
param
(
[Parameter(Mandatory)] [String]$DomainFQDN,
[Parameter(Mandatory)] [System.Management.Automation.PSCredential]$DomainAdminCreds
)
Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 9.0.0
[String] $DomainNetbiosName = (Get-NetBIOSName -DomainFQDN $DomainFQDN)
[PSCredential] $DomainAdminCredsQualified = New-Object PSCredential ("${DomainNetbiosName}\$($DomainAdminCreds.UserName)", $DomainAdminCreds.Password)
[String] $ComputerName = Get-Content env:computername
Node localhost
{
Computer JoinDomain
{
Name = $ComputerName
DomainName = $DomainFQDN
Credential = $DomainAdminCredsQualified
}
}
}
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:
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 Value
---- -----
PSVersion 5.1.20348.1366
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.1366
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
ComputerManagementDsc version
Name Version Path
---- ------- ----
ComputerManagementDsc 9.0.0 C:\Program Files\WindowsPowerShell\Modules\ComputerManagementDsc\ComputerManagementDsc.psd1
- 主要言語
- PowerShell
- スター
- 338
- フォーク
- 80
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dsccommunity/ComputerManagementDsc のほかの issue
-
chore
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
chore
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
-
chore
難易度 4/5 3〜5日 初心者へのやさしさ 64/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
dsccommunity/ComputerManagementDsc の issue をすべて見る
似ている issue
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Nmap
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
Mend: dependency security vulnerability untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
blocklist removal
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
MetaMask/eth-phishing-detect#296544 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Azure/azure-functions-docker#1257 ·