Solved

Generate Random passwords for domain users ?

Posted on 2006-11-07
9
384 Views
Last Modified: 2012-06-21
we are migrating our domain from 2000 to 2003, we have created new users accounts and now we need to generate new random passwords for the users?

is there a tool.. script... that can be used to create the random password for the users, since i do not want to reset them all to a common password .

i need to have for each user random password ?

0
Comment
Question by:ajalboush
9 Comments
 
LVL 22

Expert Comment

by:Christopher McKay
ID: 17887584
Is this what you're looking for?

http://www.winguides.com/security/password.php

Hope this helps!

:o)

Bartender_1
0
 
LVL 9

Expert Comment

by:vsg375
ID: 17888087
Good link indeed !

Here's another one to an installable version (can be helpful if no Inet is available)

http://www.snapfiles.com/download/dlranpass.html

HTH
Cheers
0
 
LVL 5

Expert Comment

by:MarkusKolbeck
ID: 17888494
you can perform those tasks with the following vbScript:

_____________________________________
Option Explicit
Dim Title, NumChar, Count, strRdm, intRdm, i, strNewPassword, dtStart
Dim strUserName, objConnection, objCommand, objRecordSet, objUser

strUserName = InputBox("Please enter the Username (samAccountName)", "Provide the Username", "MarkusK")

ResetPassword(CheckForUser(strUserName))

Function CheckForUser(samAccountName)

    dtStart = TimeValue(Now())
    strUserName = samAccountName
    Set objConnection = CreateObject("ADODB.Connection")
    objConnection.Open "Provider=ADsDSOObject;"
 
    Set objCommand = CreateObject("ADODB.Command")
    objCommand.ActiveConnection = objConnection
 
       '**** - Replace dc=fabrikam,dc=com with your Domain
    objCommand.CommandText = "<LDAP://dc=fabrikam,dc=com>;(&(objectCategory=User)" & _
            "(samAccountName=" & strUserName & "));samAccountName,distinguishedName;subtree"
   
    Set objRecordSet = objCommand.Execute
 
    If objRecordset.RecordCount = 0 Then
            WScript.Echo "sAMAccountName: " & strUserName & " does not exist."
                                Wscript.quit
    Else
        CheckForUser = objRecordSet.Fields(1)
    End If
 
    objConnection.Close
   
End Function


Sub ResetPassword(ByVal strUserDN)


      WScript.Echo strUserDN
      '**** - Define the new password
      strNewPassword = CreateRandomPassword

      '**** - Bind to the AD User Object
      Set objUser = GetObject("LDAP://" & strUserDN)
      
      '**** - Reset the password
      'objUser.SetPassword strNewPassword
      
      '**** - Delete the Script-Object
      Set objUser = Nothing
      
      WScript.Echo "The Password for User " & strUserName & " (" & strUserDN & ") has been set to: " & strNewPassword

End Sub


Function CreateRandomPassword()

      '**** - Set the password length, e.g. 8 characters
      NumChar = 8
      
      '**** - Perform a "real" randomize
      Randomize Timer
      
      '**** - Generate Password
      Do Until Count = NumChar
            Count = Count + 1
            GetRdm
            strRdm = strRdm & Chr(intRdm)
      Loop
      
      '**** - Return the value
      CreateRandomPassword = strRdm

End Function

Sub GetRdm

  intRdm = Int((122 - 49) * Rnd + 48)
 
  '**** - Enable the next line to get only alphanumeric passwords; otherwise you get complex passwords
  If intRdm > 57 And intRdm < 65 Or intRdm > 90 And intRdm < 97 Then GetRdm
 
End Sub
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 5

Expert Comment

by:MarkusKolbeck
ID: 17888501
you can also write the whole list of usernames - passwords into a text file, excel, or whatever you wish.

let me know if you need further assistance.

ATB
Markus
0
 
LVL 5

Expert Comment

by:MarkusKolbeck
ID: 17888535
one thing I forgot while testing:
you'll have to remove the ' in the line:
'objUser.SetPassword strNewPassword
in order to set the password

Otherwise the script only SAYS that the password was reset.

;-)

ATB
Markus
0
 
LVL 9

Expert Comment

by:vsg375
ID: 17888760
Excellent script, Markus ! I'll definitely keep it !

Cheers
0
 
LVL 5

Expert Comment

by:MarkusKolbeck
ID: 17888796
(: THXS :)
0
 

Accepted Solution

by:
RomMod earned 0 total points
ID: 17935471
Issue resolved - question PAQ'd and the 500 points have been revoked.

RomMod
Community Support Moderator
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Organizations create, modify, and maintain huge amounts of data to help their businesses earn money and generally function.  Typically every network user within an organization has a bit of disk space to store in process items and personal files.   …
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question