Re: Complex Password Scripting



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
.



Relevant Pages

  • Re: Automating FTP transfers
    ... the passwords is added to the script just before it ... * To join/leave the list, search archives, change list settings, * ... Authorised and regulated by the Financial Services Authority. ...
    (comp.sys.hp.mpe)
  • RE: Local Admins
    ... Write a Perl script to handle it. ... change the passwords of local admins, ... when any new member is added to one of these groups. ... when someone in our group questioned whether we'd be sending passwords ...
    (Focus-Microsoft)
  • Re: Send notification before PWDs expire
    ... built-in notification for PWDs expiration, ... interested in something like “Lots of people have taken the script and run ... make this deployment successful in a production environment. ... Finding the expiring passwords is not that big of a deal. ...
    (microsoft.public.windows.server.active_directory)
  • Re: Problem running a script
    ... I thought of that but when I imported the users I assigned them all passwords ... ' UserAccountControl .vbs ... ' The heart of this script - Enable users ... how do I determine which part of domain policy is stopping ...
    (microsoft.public.windows.server.active_directory)
  • Re: Complex Password Scripting
    ... Greg wrote: ... 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. ... 'objUser.SetPassword strPass ...
    (microsoft.public.windows.server.scripting)