Found in the AD Best Practice guide:

http://www.microsoft.com/downloads/details.aspx?FamilyID=c0dbeb7e-d476-4498-9f6c-24974fb81f1e&DisplayLang=en

 

 

 

Forcing Password Expiration Using a Script

Forcing the expiration of all user account passwords and then manually resetting the passwords would be impractical in any but a very small organization. For larger organizations, consider forcing the expiration of user account passwords with a script like the one provided below.

Description

This script forces users to change their account passwords the next time they logon.

Script Code

Set objConnection = CreateObject("ADODB.Connection")

objConnection.Open "Provider=ADsDSOObject;"

 

Set objCommand = CreateObject("ADODB.Command")

objCommand.ActiveConnection = objConnection

 

objCommand.CommandText = _

 "<LDAP://ou=Management,dc=NA,dc=fabrikam,dc=com>;" & _

 "(&(objectCategory=Person)(objectClass=user));" & _

 "ADsPath;subtree"

 

Set objRecordSet = objCommand.Execute

 

While Not objRecordset.EOF

  strADsPath = objRecordset.Fields("ADsPath")

  Set objUser = GetObject(strADsPath)

  objUser.Put "pwdLastSet", 0

  objUser.SetInfo

  objRecordSet.MoveNext

Wend

WScript.Echo objRecordSet.RecordCount & _

 " user account objects must change the " & _

 "password at next logon."

 

objConnection.Close

 

Disclaimer

The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.

 

 

-----Original Message-----
From: Daniel Chaveco [mailto:[EMAIL PROTECTED]
Sent:
Monday, June 30, 2003 10:04 AM
To: [EMAIL PROTECTED]
Subject: [ActiveDir] All Users Prompted to Change Password

 

Is there a way I can get all of the users in my domain to change their passwords at the same time using GP or some other method, other than having to check off Change Password at Next Logon for each user. I have 500 users.

 

Thanks

-DC


Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

Reply via email to