+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
Coding Thread, How do you create your AD users? in Coding and Web Development; Hello, I am looking for a way to create new user accounts. I have got a scheduled report that runs ...
  1. #1

    Join Date
    May 2006
    Location
    West Bromwich
    Posts
    2,182
    Thank Post
    299
    Thanked 211 Times in 181 Posts
    Rep Power
    53

    How do you create your AD users?

    Hello,

    I am looking for a way to create new user accounts.

    I have got a scheduled report that runs in Sims.Net that extracts the users added to the roll list for that day and creates a .csv file. Now, I need to use this CSV file to create a new file with the right output to feed into a script I already have to create users. The script that creates the users is a vbscript.

    I need to edit the name of the user to create the username, in the format of first name, first letter of the last name and a number (taken from their age on the system at registration time). An example: Joe Bloggs would be joeb6, but I think I can do this bit.

    I also need to create the home dir for OS X, but this I think I can do as well
    The issue is I'm not sure how to do this. Am I making this more difficult than it needs to be?

    How do you guys do it?

  2. IDG Tech News
  3. #2

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    7,711
    Thank Post
    1,574
    Thanked 740 Times in 691 Posts
    Rep Power
    254

  4. 2 Thanks to mac_shinobi:

    HodgeHi (7th February 2012), stevenlong1985 (26th September 2012)

  5. #3

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 305 Times in 243 Posts
    Rep Power
    112
    Not that differently to you TBH. I use powershell with the 2008 R2 native ActiveDirectory module. Powershell really loves working with CSVs and makes this kind of thing relatively easy.. 20 lines max, or even one line if you've got a very widescreen and not much 'common' sense. PS is also good at string manipulation e.g. picking bits from a few columns to arrive at something like 'joeb6', or at least it seems that way if you've written any C# because the code is essentially identical.
    Last edited by PiqueABoo; 6th February 2012 at 07:06 PM. Reason: ytpo

  6. #4

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    7,711
    Thank Post
    1,574
    Thanked 740 Times in 691 Posts
    Rep Power
    254

  7. 2 Thanks to mac_shinobi:

    HodgeHi (7th February 2012), sparkeh (8th January 2013)

  8. #5

    Join Date
    May 2006
    Location
    West Bromwich
    Posts
    2,182
    Thank Post
    299
    Thanked 211 Times in 181 Posts
    Rep Power
    53
    I was thinking more along the line of it being fully automated. I am downloading it now to have a look at it now..


    Quote Originally Posted by PiqueABoo View Post
    Not that differently to you TBH. I use powershell with the 2008 R2 native ActiveDirectory module. Powershell really loves working with CSVs and makes this kind of thing relatively easy.. 20 lines max, or even one line if you've got a very widescreen and not much 'common' sense. PS is also good at string manipulation e.g. picking bits from a few columns to arrive at something like 'joeb6', or at least it seems that way if you've written any C# because the code is essentially identical.
    I'm not a great coder by any sense of the word. I am just barely able to create a HTML page

    I can usually read a script well enough to allow me to cobble something together but thats about it. As we get pupils coming in throughout the year and get no warning of their arrival, when it comes to ICT they have no user account. This is the reason I was going to automate the process. So the scheduled task runs to create the nightly CSV file of any pupils added on roll that day and then once this has been created, to then manipulate the file to create a csv file to run into the vbscript, all without manual intervention.

    Is it possible to see your script PiqueABoo so as to give me an idea of what I would be looking to accomplish? Is your process completely automated too?

  9. #6


    Join Date
    Sep 2007
    Location
    UK
    Posts
    4,428
    Thank Post
    1,077
    Thanked 624 Times in 413 Posts
    Rep Power
    435
    I use Active User Manager Mikey Magic's Web Site - Active User Manager

    Not what you are looking for but might help someone else after ideas.

  10. #7

    Join Date
    Feb 2011
    Location
    Australia
    Posts
    109
    Thank Post
    0
    Thanked 9 Times in 9 Posts
    Rep Power
    6
    We use a batch file, created by exporting data from our Student Administration System.

  11. #8


    Join Date
    Feb 2007
    Location
    51.405546, -0.510212
    Posts
    5,952
    Thank Post
    180
    Thanked 1,795 Times in 1,338 Posts
    Rep Power
    467
    @HodgeHi. You may find the following articles useful too (taken from this thread)...

    Code:
    Automate User Provisioning with Windows PowerShell
    Part 1 (Video), Part 2 (Video), Part 3, Part 4

  12. 2 Thanks to Arthur:

    Diello (8th February 2012), HodgeHi (24th February 2012)

  13. #9

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 305 Times in 243 Posts
    Rep Power
    112
    Quote Originally Posted by HodgeHi View Post
    Is it possible to see your script PiqueABoo so as to give me an idea of what I would be looking to accomplish? Is your process completely automated too?
    Nope & nope. I don't mind sorting out some kind of example with all the key elements though, just not now (busy). Meanwhile, do your new student accounts go in different OUs and/or groups subject to their cohort/year-of-entry or something?

  14. #10

    Join Date
    May 2006
    Location
    West Bromwich
    Posts
    2,182
    Thank Post
    299
    Thanked 211 Times in 181 Posts
    Rep Power
    53
    Sorry I haven't replied only just seen the new posts.

    I have now managed to tweak a script I had for creating users to check the csv file created from the SIMS Command line. Everything works as I had hoped it would except for one thing. When I manually run the script everything works fine. The users get pulled in from the csv file and the accounts get created in the AD. The user homes are also created and the OS X default template is copied in to the newly created home dir. Then the script uses the CACLS cmd to set the perms on the folders.

    However, when the script is added to a scheduled task it doesn't manage to copy the folders over to the home dir and set the perms. The error is logged as a error 76 - Path not found.

    Am I creating the scheduled task properly? Can you even schedule a VBS file to run?

  15. #11
    zag
    zag is offline
    zag's Avatar
    Join Date
    Mar 2007
    Location
    Reading, UK
    Posts
    2,743
    Blog Entries
    10
    Thank Post
    522
    Thanked 261 Times in 221 Posts
    Rep Power
    73

  16. Thanks to zag from:

    sparkeh (8th January 2013)

  17. #12

    Little-Miss's Avatar
    Join Date
    Oct 2007
    Location
    Birmingham
    Posts
    4,573
    Blog Entries
    2
    Thank Post
    2,045
    Thanked 401 Times in 286 Posts
    Rep Power
    296
    Wait...i can schedule SIMS to the report for me?! How?! (I dont know the ins and outs of SIMS)

  18. #13

    Join Date
    Mar 2011
    Location
    Bournemouth
    Posts
    255
    Thank Post
    14
    Thanked 68 Times in 59 Posts
    Rep Power
    18
    I use an automatic powershell script which runs every night that reads on-roll student data directly from sims, creates users accounts, home folders with permissions, mailboxes etc for new students and automatically archives the files and mail of old students and then deletes them. Its fully automated and can even handle and implement name changes because it stores admission numbers and upns in AD which it uses to compare users, no csv files or user interaction needed.

    There are products available for sims which do something similar but they're not cheap and not as customisable as a powershell script so I wrote my own.

    We also have powershell scripts for bulk import of users from csv etc in case its needed, its not hard at all to work with csvs in powershell as has been mentioned already.

  19. #14
    skunk's Avatar
    Join Date
    Mar 2006
    Location
    North West
    Posts
    308
    Thank Post
    84
    Thanked 37 Times in 32 Posts
    Rep Power
    26
    @ChrisMiles A bit cheeky I know but could we have a look at the powershell script, complete newb to powershell here.

  20. #15

    Join Date
    Mar 2011
    Location
    Bournemouth
    Posts
    255
    Thank Post
    14
    Thanked 68 Times in 59 Posts
    Rep Power
    18
    The script is specific to our school, sims and AD configuration so I'd rather not make it public domain this time. Needless to say though, it really isn't hard and I can tell you where/how to get the data from sims using sql queries if you want.

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

Similar Threads

  1. Audit Tool - How do you Audit your exuipment
    By Nij.UK in forum General Chat
    Replies: 7
    Last Post: 4th November 2008, 12:33 PM
  2. How do you backup your Server(s)?
    By elsiegee40 in forum Windows
    Replies: 56
    Last Post: 7th February 2008, 09:44 AM
  3. Wallpaper - how do you manage yours?
    By Halfmad in forum Windows
    Replies: 9
    Last Post: 16th July 2007, 11:48 AM
  4. How do you define your 'last rolo'
    By Ben_Stanton in forum General Chat
    Replies: 39
    Last Post: 26th January 2007, 02:16 PM
  5. How do you seperate your networks. Subnet / Vlan
    By drjturner in forum Wireless Networks
    Replies: 16
    Last Post: 28th September 2006, 07:24 AM

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
  •