Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can anyone help me out on this simple script? 1

Status
Not open for further replies.

bdragun

MIS
Jan 28, 2003
30
US
can anyone help me out on this simple code? i am trying change passwords to a simple password in active directory when this script runs. It changes the password fine the problem becomes when i try to reset the User must change password at next logon option. At first i was thinking it was my LDAP query but like i said it changes the users password fine. And i already looked at the microsoft technet article:

here is the script:

strUserName = InputBox ("Enter the username")
Set objUser = GetObject("LDAP://OURDOMAIN/" & strUsername & ",user")
objUser.Put "pwdLastSet", 0
objUser.SetInfo

objUser.SetPassword "password"
 
to expire a users account so they have to change it

objUser.Put "PasswordExpired", 1
objUser.SetInfo

if you want to remove...

objUser.Put "PasswordExpired", 0
objUser.SetInfo

give it a whirl

mrmovie
 
hello, i think you might find that what i have put is correct...your AD will support you connecting to it by supplying the WinNT part,,,prob something to do with people being able to us NT machines as part of a AD domain,,,just change the domain to be yours
 
n o offense intended but you aked for advice on how to do something.

i am running windows2000 in an Active Directory which is in NATIVE mode,,,when i run the following it returns FALSE
which means my account isnt locked out.

give the stuff i sent you a try before correcting me on mistakes which i dont think i have made....heres a smile though
;-)))))


userdomain = "domfsc01"
username = "mchrmoyl"
Set User = GetObject("WinNT://" & userdomain & "/" & username & ",user")

msgbox User.IsAccountLocked




have you tried the below from the other post???


u need to use adsi.
its is tricky due to some Dc being upto date and others not, simple version would be

Set User = GetObject("WinNT://" & userdomain & "/" & username & ",user")
If User.IsAccountLocked = True Then
User.IsAccountLocked = False
User.SetInfo
End If
 
I am sorry, yes they both are working.

Thanks again
 
no probs, if you are interested in manip'ing AD or any other ldap type of stuff you should invest in
ISBN 1-57870-219-4
adsi scripting for system admin

be careful of what Domain controller the helpdesk person is connection to, it will the one in their zone or LAN or whatever,,,this might be a different DC to one that the user in scotland is being validated against....in this case you might have to do something clever with a script that always connects the Domain master central don gordon server,,,or connect to the one that will authenticate the user.....
 
Yeah i will do plenty of testing before i go live with the scripts. and i will check out the book too

you've been a great help, and i will probably be posting some more issues when i have them so keep an eye out. haha

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top