About Terminal Server, Citrix, Delphi and other stuff
I needed to do a mass password change on imported accounts and decided to do this with Powershell. For some reason (maybe because I am using PowerShell 2.0) I got an unexpected error when using the Password property or the SetPassword method (RandomPassword is a function I wrote that generates Random passwords the meet the Complexity Requirements):
The following exception occurred while retrieving member “CommitChanges”: “Logon failure: unknown user name or bad password.
I first thought that my Password Generator function created a password that didn’t meet the Complexity Requirements but settings the same password through Active Directory Users & Computers was no problem.
I also tried the SetPassword method but it has the same result. The only working way was to use the Invoke method of PSBase:
I also verified if using a simple password gave another error:
Exception calling “Invoke” with “2″ argument(s): “The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements. (Exception from HRESULT: 0x800708C5)”
I don’t know why the Password Property and SetPassword Method do not work but I guess it’s a problem in PowerShell’s implementation of the ADSI provider. If someone has the answer please leave a comment!
Related posts:
Active Directory Altiris bug Citrix Dell Delphi Exchange Exchange2003 Exchange2010 Hewlett-Packard HP iOS Jailbreak Java LinkedIn Linux MSI MySQL Navigation Objects Office Outlook Passat PowerPoint PowerShell referall was returned RNS315 RNS510 SasLibEx script slow Terminal Server ThinApp TSAdmin TSAdminEx VBS VCDS Vista VMWare Volkswagen Windows PE WLAN Wordpress WTSWaitSystemEvent wts_event_flush
WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.
One Response for "PowerShell 2.0: Changing password through ADSI problem"
to use with setpassword you may have to use
$secure_string_pwd = convertto-securestring “Password2007″ -asplaintext -force
Leave a reply