No announcement yet.

Script for adding users with passwords

  • Filter
  • Time
  • Show
Clear All
new posts

  • Script for adding users with passwords

    I have a .csv file which contains the username, full name, password and description for over 250 users which I need to add to an ou on a Windows 2003 server.

    I do not want to use CSVDE because it won't let me add the passwords.

    I thought I saw a script that would enable one to do this, like something that gets run via cscript or wscript. I haven't scripted in several years and out of touch.

    Can someone point me to the right script? I remember there was something along that line in the MCSE study material... I just don't remember.

    Any help is appreciated.

  • #2
    Re: Script for adding users with passwords

    Have you tried using LDIFDE or DSADD??

    Are you using Windows 2000 or 2003??




    • #3
      Re: Script for adding users with passwords

      I looked at LDIFDE before and I'd have to mess around with the CSV file a bit.

      I'll check out DSADD, but I actaully went and purchased a little program for circa $34. It's called AD Bulk Import, sold by

      It did exactly what i needed. It took my .CSV and imported it including passwords etc. Quite flexible little utility actually.

      I'll look at DSADD now... maybe I could've done it differently. But now it's done.

      Thanks wullieb1


      • #4
        Re: Script for adding users with passwords

        Glad to have helped.

        I'm not know as a scripter and have never professed to being one so i just hope the info was suitable.


        • #5
          Re: Script for adding users with passwords

          technet is the way!

          go to microsoft technet and then search for "Create User Accounts based on information in a spreadsheet".

          This will create users, not password tho, now password you can do by altering the script by adding a property. With my instance i find that i give everyone in the same OU the SAME orginal password, and force new password on first logon.

          This is good enuff for me, or i could force a random complex password, but then id have to tell the user wot it is. i dont that sort of patience hahaha.
          Hope that helps, i looked at bulk import, its a nice little tool, but what it does is exsactly wat can be done with that script from technet.

          But fear not, what ever works works, as netadmins were not paid for sophistication were paid for uptime. Thats my saying feel free to tell ur friends hahaha PEACE


          • #6
            Re: Script for adding users with passwords

            here is a script that i use to add users with passwords, wrote it myself modified it to use a csv file for u, the csv file would have the first name , then the last name and everyone having the same password. if everyone needs a different password that would be easy to do with this also. change DomainName to the name of your domain wherever u see it.

            Const ADS_PROPERTY_APPEND = 3
            set WshShell = WScript.CreateObject("WScript.Shell")
            Set FSO = CreateObject("Scripting.FileSystemObject")

            Set NamesFile = FSO.OpenTextFile("names.csv", 1)
            fullname = "a"

            do until namesfile.AtEndOfStream
            Temp = NamesFile.ReadLine
            NamesList = Nameslist & ", " & temp
            if temp <> "" then
            Seperator = instr(Temp, ",") + 1
            Seperator2 = instr((seperator), temp, ",") - 1
            FirstName = left(Temp, Seperator - 2)
            LastName = Mid(Temp, Seperator, Seperator2 - Seperator + 1)
            userName = Left(firstname,1) & lastname
            FullName = FirstName & " " & LastName

            Set objOU = GetObject("LDAP://ou=Production,dc=DomainName,dc=local")

            'create user account
            Set objUser = objOU.Create("user", "cn=" & fullname)
            objUser.Put "sAMAccountName", username
   = LastName
            objuser.givenname = FirstName
            objuser.physicalDeliveryOfficeName = "MD"
            objuser.displayname = FirstName & " " & LastName
            objuser.userPrincipalName = UserName & "@DomainName.local"
            objuser.Description = "Contact Center Representative"

            'stuff that has to be set after account created
            objuser.ChangePassword "", "password"
            objuser.AccountDisabled = FALSE
            objUser.Put "pwdLastSet", 0

            'put in groups
            Set objGroup = GetObject _
            ("LDAP://cn=MD_Contact Center,dc=DomainName,dc=local")
            objGroup.PutEx ADS_PROPERTY_APPEND, _
            "member", Array("cn=" & fullname & ",ou=Production, dc=DomainName, dc=local")

            Set objGroup = GetObject _
            ("LDAP://cn=MD_Contact Center Printers,dc=DomainName,dc=local")
            objGroup.PutEx ADS_PROPERTY_APPEND, _
            "member", Array("cn=" & fullname & ",ou=Production, dc=DomainName, dc=local")

            end if


            msgbox("The Following Users have been Set up" & nameslist)
            MCSE 2000\2003, A+