Solved

Generate Random passwords for domain users ?

Posted on 2006-11-07
9
382 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
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.

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

910 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

15 Experts available now in Live!

Get 1:1 Help Now