+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 22
Scripts Thread, Script to populate AD fields in Coding and Web Development; Hi, All of our student user accounts do not have the First Name and Surname field populated. How ever the ...
  1. #1

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,043
    Thank Post
    888
    Thanked 1,727 Times in 1,490 Posts
    Blog Entries
    12
    Rep Power
    453

    Script to populate AD fields

    Hi,

    All of our student user accounts do not have the First Name and Surname field populated. How ever the Full Name field is populated with the students full name.

    Does anyone have a script that can copy the first word from the Full Name field and put that into the first name field then put the remaining words into the surname field?

    I have found scripts to import accounts, reset passwords on bulk but do nothing like this.

    Any help would be appreciated.

    Z

  2. #2


    Join Date
    Feb 2007
    Location
    Northamptonshire
    Posts
    4,692
    Thank Post
    352
    Thanked 797 Times in 716 Posts
    Rep Power
    347
    I don't have my scripting head on at the moment but you could use Wisesoft's brilliant bulk updater, point it at an OU, get it to take the current content into a spreadsheet, hack it up with splits on the full name field and then push the changes back in.

    http://www.wisesoft.co.uk/software/b...s/default.aspx


  3. 4 Thanks to kmount:

    FN-GM (28th July 2009), Jackd (29th July 2009), john (28th July 2009), maniac (28th July 2009)

  4. #3

    john's Avatar
    Join Date
    Sep 2005
    Location
    London
    Posts
    10,619
    Thank Post
    1,499
    Thanked 1,053 Times in 922 Posts
    Rep Power
    304
    Agree with that suggestion, used it myself for various things and its great

  5. #4

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,043
    Thank Post
    888
    Thanked 1,727 Times in 1,490 Posts
    Blog Entries
    12
    Rep Power
    453
    Thanks,

    Can anyone else vouch for this software? Last thing i want is for it to bugger up AD.

  6. #5

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,785
    Thank Post
    3,294
    Thanked 1,054 Times in 975 Posts
    Rep Power
    365
    Quote Originally Posted by FN-GM View Post
    Thanks,

    Can anyone else vouch for this software? Last thing i want is for it to bugger up AD.
    I have used wisesofts password reset util ( registration is free ) and so are downloads etc and works a charm so am guessing that would be the same - if your worried about that you could use a virtual machine and install server 2003 and make a few dummy accounts to test and see if it works how you want it.

    WiseSoft - Resources for IT Professionals

  7. #6

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,043
    Thank Post
    888
    Thanked 1,727 Times in 1,490 Posts
    Blog Entries
    12
    Rep Power
    453
    I have a Virtual Server farm with 4 Server 2008 Machines but i will test on that first. Because it works on the test doesn't mean it will work live

  8. #7

    EduTech's Avatar
    Join Date
    Aug 2007
    Location
    Reading
    Posts
    5,068
    Thank Post
    160
    Thanked 925 Times in 727 Posts
    Blog Entries
    3
    Rep Power
    273
    WiseSoft Sofware has worked very well for me! and to be honest i would trust his software over a script

  9. #8

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,156
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    This will work but note that it could add first name/last name to objects which aren't ordinary users. It checks to see if the first name or surname are already set and it also makes sure there is a space in the name but it can't cope with (eg) John Smith Jones, Jane Mary Moore or Mr J Baker.

    If all your pupils are under a single top level OU then you could change the line which works out sDomain so it says something like sDomain="ou=pupils, dc=schoolname,dc=county,dc=sch,dc=uk"

    Code:
    Set oRoot=getobject("LDAP://rootdse")
    sDomain=oRoot.get("defaultNamingContext")
    Set oConn = CreateObject("ADODB.Connection")
    oConn.Provider = "ADsDSOOBJECT"
    oconn.Open
    sQuery = "<LDAP://" & sDomain & ">;(&(objectClass=user)(objectcategory=person));ADsPath, displayname;subtree"
    Set oRS = oConn.Execute(sQuery)
    do While Not oRS.EOF
        sUser=oRS("ADSPath")
        sDisplay=ors("displayname")
        iSpace=instr(sDisplay," ")
        if iSpace<>0 then
          sGivenName=left(sDisplay,iSpace-1)
          sSurname=mid(sDisplay,iSpace+1)
          Set oUser=getobject(sUser)
          if oUser.givenname="" and oUser.sn="" then 
            wscript.echo "changing"
            oUser.GivenName=sGivenName
            oUser.sn=sSurname
            oUser.setinfo
          end if
        end if
      oRS.MoveNext
    loop

  10. #9

    maniac's Avatar
    Join Date
    Feb 2007
    Location
    Kent
    Posts
    3,067
    Thank Post
    209
    Thanked 430 Times in 310 Posts
    Rep Power
    144
    Quote Originally Posted by kmount View Post
    I don't have my scripting head on at the moment but you could use Wisesoft's brilliant bulk updater, point it at an OU, get it to take the current content into a spreadsheet, hack it up with splits on the full name field and then push the changes back in.
    Just what I'm looking for, need to get my staff details updated with proper names, looks like this will do the trick nicely

    Mike.

  11. #10


    Join Date
    Feb 2007
    Location
    Northamptonshire
    Posts
    4,692
    Thank Post
    352
    Thanked 797 Times in 716 Posts
    Rep Power
    347
    Quote Originally Posted by FN-GM View Post
    Thanks,

    Can anyone else vouch for this software? Last thing i want is for it to bugger up AD.
    I can completely understand your concern but you'll be pleased to know it has roll back functionality is the changes aren't quite what you wanted it'll roll them back.

    There are a couple of other useful tools on there, the password reset one is nice and the account management spreadsheet which can create users etc from simple data.

    Definitely one for the toolkit guys

  12. Thanks to kmount from:

    FN-GM (29th July 2009)

  13. #11

    tmcd35's Avatar
    Join Date
    Jul 2005
    Location
    Norfolk
    Posts
    5,694
    Thank Post
    853
    Thanked 899 Times in 744 Posts
    Blog Entries
    9
    Rep Power
    329
    @FN-GM: I will 100% vouch for Wisesofts products. They are absolutely fantastic. Rolling 'PasswordControl' out to ICT teacher so they can change pupils passwords (as I did at the last school). Use BulkADUser semi-regularly to make changes to AD. About to make changes to logon script location which I'll run through this for all users.

    I'm going to use the Account Manager spreadsheet this year to add the new year 7's to AD. Beats re-writting the Pascal code I've used in previous years

  14. Thanks to tmcd35 from:

    FN-GM (29th July 2009)

  15. #12

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,043
    Thank Post
    888
    Thanked 1,727 Times in 1,490 Posts
    Blog Entries
    12
    Rep Power
    453
    Thanks guys, i will look into this next week.

    I have setup Moodle and it using LDAP so i need the firstname and surname feild to be in there.

  16. #13

    EduTech's Avatar
    Join Date
    Aug 2007
    Location
    Reading
    Posts
    5,068
    Thank Post
    160
    Thanked 925 Times in 727 Posts
    Blog Entries
    3
    Rep Power
    273
    For Reference, I have just made a bulk change on my 2008 Test Domain and it worked perfectly!

  17. #14

    nephilim's Avatar
    Join Date
    Nov 2008
    Location
    Dunstable
    Posts
    12,027
    Thank Post
    1,632
    Thanked 1,930 Times in 1,420 Posts
    Blog Entries
    2
    Rep Power
    436
    I too also did a bulk change and update, worked fine here. Admittedly was on a virtual server, but I am creating a new OU and gonna run a few tests on my live server in a min!

  18. #15

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,043
    Thank Post
    888
    Thanked 1,727 Times in 1,490 Posts
    Blog Entries
    12
    Rep Power
    453
    Cheers, now just finding out how to seperate them in excel

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. [PHP] Including multiple fields in form mailer
    By -Jim in forum Web Development
    Replies: 5
    Last Post: 27th March 2009, 10:09 PM
  2. Formatting Data Fields
    By tw15ns in forum MIS Systems
    Replies: 1
    Last Post: 3rd January 2009, 03:38 PM
  3. [MS Office - 2003] Access - Calculated Fields
    By garethedmondson in forum Office Software
    Replies: 2
    Last Post: 11th December 2008, 03:22 PM
  4. Replies: 1
    Last Post: 3rd October 2008, 11:36 AM
  5. Quick letter fields not substituted
    By cjohnsonuk in forum MIS Systems
    Replies: 4
    Last Post: 20th March 2008, 01:42 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •