Re: Complex Password Scripting
- From: "/\\/\\o\\/\\/ [MVP]" <no@xxxxxxxx>
- Date: Wed, 11 Jan 2006 23:21:59 +0100
Greg wrote:
"/\\/\\o\\/\\/ [MVP]" wrote:
Greg wrote:
"/\\/\\o\\/\\/ [MVP]" wrote:
Greg wrote:
I have an OU that will have about two hundred users in it. The operations manager wants to change all of the passwords to ie. "ABCDEF%1%2" ABCDEF would be a fixed variable and %1 would be the first initial of the users first name, and %2 would be the first initial of users last name. I have the script for modifying all passwords in the OU to the same password. This is going to be used so that they can login to OWA and then change their password. He does not want them all to have the same password.
Any ideas? He also informed me that I need to do this tonight so I am up against a wall.
Thanks in advance
Greg
If you can post the part that sets the password, (and getting the user object)
i will look, how to construct the string
gr /\/\o\/\/
Thanks GR. The script that I have right now is below. What I think we are going to do is perl out all of the accounts and basically generate this VB script 200 times. My only question is can I run a vb script two hundred times in the same vbs file. In other words put this script back to back 200 times with the changes for each user?
PATH_OU = "ou=GROUP,dc=x,dc=y"
Set objContainer = GetObject("LDAP://OU=AD, dc=x, dc=yl" & PATH_OU) objContainer.Filter = Array("user")
For Each objChild In objContainer
'* get DistinguishedName strDN = objChild.Name & "," & PATH_OU
'* replace reserved char / strDN = replace(strDN,"/","\/")
Set objUser = GetObject("LDAP://OU=AD, dc=x, dc=y" & strDN) objUser.SetPassword "ABCDEF%1%2!"
you could change this :
'strFirstname = objUser.givenname 'strLastName = objUser.sn
strFirstname = "mow" strLastName = "Last"
strFL = Mid(strFirstname,1,1) strLL = Mid(strLastName,1,1) strPass = strFL & "123" & strLL
wscript.echo strPass 'objUser.SetPassword strPass
gr /\/\o\/\/
OK you are assuming that I know way too much about scripting. If you can help with this I would greatly appreicate this as well.
The LDAP is tblc.local The OU the accounts are in is called Hosted.
Can you do the script that binds to the domain, everytime I write it, it comes up and says object not on server. Once I see a working script I think I can figure it out for future.
Basically a fully working script. Sorry for the ignorance, but I am learning and failing miserably. Thanks again
just replace
objUser.SetPassword "ABCDEF%1%2!"
with
strFirstname = objUser.givenname strLastName = objUser.sn
strFL = Mid(strFirstname,1,1) strLL = Mid(strLastName,1,1) strPass = "ABCDEF" & strFL & strL
wscript.echo strPass 'objUser.SetPassword strPass
you will see the generated passwords, on the screen if they are OK you can remove the ' in the last line and it will work.
gr /\/\o\/\/
working example
Set objUser = GetObject("LDAP://localhost:389/cn=mow,ou=mowOu,dc=mow,dc=adam")
strFirstname = objUser.givenname strLastName = objUser.sn
strFL = Mid(strFirstname,1,1) strLL = Mid(strLastName,1,1) strPass = "ABC123" & strFL & strLL
wscript.echo strPass 'objUser.SetPassword strPass
with the name MOW SURNAME,
it would be this :
MSH>cscript test.vbs Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
ABC123MS .
- References:
- Re: Complex Password Scripting
- From: /\\/\\o\\/\\/ [MVP]
- Re: Complex Password Scripting
- From: /\\/\\o\\/\\/ [MVP]
- Re: Complex Password Scripting
- From: Greg
- Re: Complex Password Scripting
- Prev by Date: [MSH] Ctrl+C does not yield a new line
- Next by Date: Re: monkier question
- Previous by thread: Re: Complex Password Scripting
- Next by thread: Re: Manage printers on remote computer
- Index(es):
Relevant Pages
|