To configuring service account for the application after creating generated password causing issue many times, needs to validate active directory (AD) credentials before configuring it. Because enterprise level policy would disable service account with bad password attempts. The PowerShell script helps to validate efficiently.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<# .DESCRIPTION Validate AD Account credential .NOTES Author: Sathiya.io #> function Man–TestADUserAuth { $cre = Get–Credential –Credential $null if((new–object directoryservices.directoryentry “”,$cre.UserName,$cre.GetNetworkCredential().Password).psbase.name –ne $null) { Write–Host “Password is valid!” –ForegroundColor Green } else { Write–Host “Sorry! Either user name or password wrong!” –ForegroundColor Red –BackgroundColor Yellow } } Man–TestADUserAuth |
Scripts makes perfect, Cheers!