Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 282
  • Last Modified:

Generate new doamin users passwords ?

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
ajalboush
Asked:
ajalboush
  • 7
  • 7
  • 5
  • +1
1 Solution
 
inbarasanCommented:
Dear ajalboush,
You may check this tool
http://www.winguides.com/security/password.php


Cheers!
0
 
ajalboushAuthor Commented:
no,

I need to a tool that can be connected to the domain so it take form there the user names and generates new passwords for them then it prints the output which is should be the user name which is taken from the active directory and the password?
0
 
Chris DentPowerShell DeveloperCommented:

Do all the users exist already? And are they in a specific place in AD?

I would guess you don't want to just change passwords for absolutely every account as that would include any administrative accounts or service accounts.

Anyway, it's not really very tricky to do, and while I'm sure my password generators aren't really very efficient they will do the job.

Chris
0
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 
Chris DentPowerShell DeveloperCommented:

Oh yes, and any requirements for the passwords? Complexity?

Chris
0
 
tomerleiCommented:

File.bat:

@echo off
SETLOCAL
FOR /F "delims=" %%i in (file.txt) do call file2.bat %%i

File2.bat:

set password=%TIME:~-2%%TIME:~6,-3%%TIME:~-2%%TIME:~6,-3%
net user %1 %password% /domain
echo Password for %1 is %password%>Passwords.txt

it will use the seconds and the milliseconds to create 8 digit password.
save both files (as file.bat and file2.bat and all user names in file.txt) the output off all users and passwords will be in Passwords.txt
0
 
tomerleiCommented:
and if you ask how to load all user names in the file.txt file do it like this:
go to Active Directory Users and Computers and select your main user container and go to the Action Menu and choose export list option, exports it to csv, after you finished exporting it you can open the file in excel, copy the users column and past it and a text file (file.txt).

Please ask if you need any further assistance.
0
 
tomerleiCommented:
Oh, and after all files have been saved to the same directory just run the file.bat to start the process.
0
 
ajalboushAuthor Commented:
the users are created and are already exit in specific ou in the AD.
0
 
tomerleiCommented:
It doesn't matter, so it will only change their passwords, if the user was on the list and is not currently on the ad it will create it.
all using the NET USER command.
0
 
ajalboushAuthor Commented:
okay, is this will applied inside the domain, I mean that i have the users already created, and i need the generated password to be changed inside the domain then i need the output ?
0
 
ajalboushAuthor Commented:
about the comlexity it  does not matter since i can change the policy.
0
 
tomerleiCommented:
Yes, you need to be logged on as the domain admin to make it run, and the output will be  on the file Passwords.txt file of which passwords belongs to which user, you will need the output for giving users their passwords.
and just a little fix:

echo Password for %1 is %password%>Passwords.txt

change it to:

echo Password for %1 is %password%>>Passwords.txt
0
 
Chris DentPowerShell DeveloperCommented:

This is a VbScript to change the passwords for everyone within that OU to semi-complex passwords. It will need saving as .vbs and you will need to fix the OU_PATH constant (the generator is definately not the most efficient). The password it sets, the username and the users name are written to a text file called Passwords.txt.

If you want to test it before using it then add a ' in front of "objUser.SetPassword strPassword" and it'll show you what it would have done.

HTH

Chris



' If the User Accounts are in the default Users OU then the path is CN=Users,. Please ensure the trailing comma is in place.

Const OU_PATH = "OU=YourOU,OU=SomeOtherOU,"

Function GeneratePassword()
      Dim intUCharCount, intLCharCount, intNumCount, intPassLen, intRNumber
      Dim strChar, strPass

      Const PASSWORD_LENGTH = 8
      
      intUCharCount = 0
      intLCharCount = 0
      intNumCount = 0
      intPassLen = 0
      
      Do while intPassLen < PASSWORD_LENGTH
            Randomize()
            intRNumber = Int(123 * Rnd() + 1)
            If (intRNumber > 64) and (intRNumber < 91) Then
                  If (intUCharCount <= 3) Then
                        strChar = Chr(intRNumber)
                        strPass = strPass & strChar
                        intUCharCount = intUCharCount + 1
                        intPassLen = intPassLen + 1
                  End If
            End If
            If (intRNumber > 96) and (intRNumber < 123) Then
                  If (intLCharCount <= 3) Then
                        strChar = Chr(intRNumber)
                        strPass = strPass & strChar
                        intLCharCount = intLCharCount + 1
                        intPassLen = intPassLen + 1
                  End If
            End If
            If (intNumCount <= 2) Then
                  Randomize()
                  intRNumber = Int(9 * Rnd() + 1)
                  strChar = CStr(intRNumber)
                  strPass = strPass & strChar
                  intNumCount = intNumCount + 1
                  intPassLen = intPassLen + 1
            End If
      Loop
      GeneratePassword = strPass
End Function

Set objFileSystem = CreateObject("Scripting.FileSystemObject")
Set objFile = objFileSystem.CreateTextFile("Passwords.txt")

Set objRootDSE = GetObject("LDAP://RootDSE")
Set objOU = GetObject("LDAP://" & OU_PATH & objRootDSE.Get("defaultNamingContext"))
Set objRootDSE = Nothing

objOU.Filter = Array("user")

For Each objUser in objOU
      strPassword = GeneratePassword()
      objFile.WriteLine objUser.Get("sAMAccountName") & "," & objUser.Get("displayName") & "," & strPassword
      objUser.SetPassword strPassword
Next
0
 
ajalboushAuthor Commented:
I did not understand the last step for what ?
0
 
tomerleiCommented:
To who you did refer the last question?
0
 
ajalboushAuthor Commented:
thanx tomerlei,
what if i want to make the password complex, i used the bat file but it always generate numbers, i need it complex ?
0
 
ajalboushAuthor Commented:
thanx tomerlei, can you answer me quickly ?
what if i want to make the password complex, i used the bat file but it always generate numbers, i need it complex ?
0
 
Chris DentPowerShell DeveloperCommented:

If you need it complex then you need to use something more capable than Batch Files.

The script I posted will create Complex passwords, the only reason I refer to them as semi-complex is that i never wrote in functionality to create passwords with symbols in ($, %, !, @, etc). However, it will provide enough of a mixture of uppercase, lowercase and numeric to qualify as complex.

HTH

Chris
0
 
Chris DentPowerShell DeveloperCommented:

Although saying that I'm sure you could do it in Batch, and I'm sure someone has before, may have been oBdA.

Chris
0
 
tomerleiCommented:
You can change the file2.bat to this:

set num=%TIME:~-1%
if %num%==0 set letter=a
if %num%==1 set letter=b
if %num%==2 set letter=c
if %num%==3 set letter=d
if %num%==4 set letter=e
if %num%==5 set letter=f
if %num%==6 set letter=g
if %num%==7 set letter=h
if %num%==8 set letter=i
if %num%==9 set letter=l
set password=%letter%%TIME:~-2%%TIME:~6,-3%%TIME:~-2%%TIME:~6,-3%
net user %1 %password% /domain
echo Password for %1 is %password% >>Passwords.txt

and it will add a random letter from a to l in each password it generates.
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 7
  • 7
  • 5
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now