Jump to content

Recommended Posts

Posted

hi

 

I have a script which will enable a teacher to reset a students password to Password1.

 

The script works well however i would like it to expire the password, so that the user has to change it to something unique. I have tried asking the teacher to ensure the students change the password, but they do not.

 

I have tried numerous commands to expire the password, with no luck so it is time i ask the clever people on here for help.

 

script is:

 

Dim UserName

Dim UserDomain

UserDomain = "our_Domain_Name"

UserName = InputBox("Enter the user's login name")

Set User = GetObject("WinNT://"& UserDomain &"/"& UserName &"",user)

 

 

Dim NewPassword

NewPassword = "Password1"

Call User.SetPassword(NewPassword)

 

 

If err.number = 0 Then

 

Wscript.Echo "The password change was successful."

 

Else

 

Wscript.Echo "The password change failed!"

 

End if

 

 

 

Thank you in advance for your help.

 

nick

Posted

All you have to do is set the expiry date of the password to a date in the past, and it will prompt them to reset it at next login. Can't remember the AD propery name, but if you use an LDAP browser you should be able to see the property in question and change it in the same way as the password in the VBscript.

 

Mike.

Posted (edited)
can someone tell me what you use then please?

 

thanks

 

I've installed the RSAT tools on the teachers PC in the IT suites and put a shortcut for ADUC on the desktop (for the member of staff in whose room it is) and delegated control of the pupils OU to IT teachers. The only access they have is to change passwords. The IT teachers do not see the rest of the RSAT tools.

 

I have also done the same for our librarian who very helpfully has agreed to change pupil passwords, result - one less PITA job for us to do!

 

I do not intend giving the rest of the teachers access to change pupil passwords

Edited by joe90bass
typo, must learn to proof read!
Posted

Just add this code:

user.passwordexpired = 1 'password needs to be changed now
user.setinfo

after the "call user.setpassword" line

 

@maniac - the ldap browser idea won't help here - it will tell you that the property is pwdlastset but because @bart21 is using the WinNT provider it won't work.

 

Why Microsoft chose to use different property names for essentially the same purpose with the different providers I don't know; it's just one of those things which makes life a misery :-)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...