Hello friends, In some scenarios tech guys have to provide their username and password to join the machine into the domain. and Task Sequence wants to store the info somewhere before execute the actual domain join step.
I have seen the problem, that sometimes builds engineers are not providing the correct username and password to the TS and the domain join step is getting failed due to incorrect username and password.
Don't worry! this is a common issue with anyone and we can fix it by checking the user is present on AD and will authenticate him at the same time when he provides the credential details to the Task Sequence.
How?
We have to create one PowerShell script for doing it
First, we have to store the user name in the $UserName variable
$UserName = Read-Host -Prompt 'Input
your User name and Enter'
store the password to $password variable as mentioned below.
$password = Read-Host -Prompt 'Input the user password and Enter' -AsSecureString
$credential = New-Object System.Management.Automation.PSCredential ($UserName, $password)
Function Test-ADAuthentication {
param(
$username,
$password)
(New-Object DirectoryServices.DirectoryEntry "",$username,$password).psbase.name -ne $null
}
if(Test-ADAuthentication $credential.UserName $credential.GetNetworkCredential().Password=true)
{
Write-Output "AD Authentication is succeeded for $UserName."
Write-Output "Thanks for using AD Authentication tool!"
}
else
{Write-Output "AD Authentication is failed. Check username and password is correct.
}
Pause
It worked for me...Thank you...you saved my time..
ReplyDeleteThanks a lot
Delete