Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Generate Random passwords for domain users ?

Posted on 2006-11-07
9
Medium Priority
?
387 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.…
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

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