+ 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
    Brisbane, Australia
    Posts
    11,181
    Blog Entries
    3
    Thank Post
    537
    Thanked 924 Times in 835 Posts
    Rep Power
    196

    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,411
    Thank Post
    322
    Thanked 715 Times in 644 Posts
    Rep Power
    199
    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
    Yorkshire
    Posts
    9,092
    Thank Post
    960
    Thanked 719 Times in 639 Posts
    Rep Power
    195
    Agree with that suggestion, used it myself for various things and its great

  5. #4

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    Brisbane, Australia
    Posts
    11,181
    Blog Entries
    3
    Thank Post
    537
    Thanked 924 Times in 835 Posts
    Rep Power
    196
    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
    6,576
    Thank Post
    836
    Thanked 583 Times in 546 Posts
    Rep Power
    163
    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
    Brisbane, Australia
    Posts
    11,181
    Blog Entries
    3
    Thank Post
    537
    Thanked 924 Times in 835 Posts
    Rep Power
    196
    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
    Birmingham
    Posts
    4,535
    Blog Entries
    3
    Thank Post
    127
    Thanked 732 Times in 573 Posts
    Rep Power
    188
    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,110
    Blog Entries
    2
    Thank Post
    110
    Thanked 511 Times in 443 Posts
    Rep Power
    114
    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,003
    Thank Post
    192
    Thanked 413 Times in 300 Posts
    Rep Power
    136
    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,411
    Thank Post
    322
    Thanked 715 Times in 644 Posts
    Rep Power
    199
    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
    3,057
    Blog Entries
    9
    Thank Post
    441
    Thanked 410 Times in 356 Posts
    Rep Power
    103
    @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
    Brisbane, Australia
    Posts
    11,181
    Blog Entries
    3
    Thank Post
    537
    Thanked 924 Times in 835 Posts
    Rep Power
    196
    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
    Birmingham
    Posts
    4,535
    Blog Entries
    3
    Thank Post
    127
    Thanked 732 Times in 573 Posts
    Rep Power
    188
    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
    Bedfordshire
    Posts
    7,165
    Blog Entries
    2
    Thank Post
    912
    Thanked 1,004 Times in 764 Posts
    Rep Power
    434
    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
    Brisbane, Australia
    Posts
    11,181
    Blog Entries
    3
    Thank Post
    537
    Thanked 924 Times in 835 Posts
    Rep Power
    196
    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, 11:09 PM
  2. Formatting Data Fields
    By tw15ns in forum MIS Systems
    Replies: 1
    Last Post: 3rd January 2009, 04:38 PM
  3. [MS Office - 2003] Access - Calculated Fields
    By garethedmondson in forum Office Software
    Replies: 2
    Last Post: 11th December 2008, 04: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, 02: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
  •