Solved

Generate Random passwords for domain users ?

Posted on 2006-11-07
9
381 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:Bartender_1
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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

by Batuhan Cetin In this article I will be guiding through the process of removing a failed DC metadata from Active Directory (hereafter, AD) using the ntdsutil tool in a Windows Server 2003 environment. These steps are not necessary in a Win…
by Batuhan Cetin Within the dynamic life of an IT administrator, we hold many information in our minds like user names, passwords, IDs, phone numbers, incomes, service tags, bills and the order from our wives to buy milk when coming back to home.…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now