+ 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,184
    Thank Post
    299
    Thanked 211 Times in 181 Posts
    Rep Power
    55

    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. #2

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,216
    Thank Post
    2,767
    Thanked 935 Times in 875 Posts
    Rep Power
    343

  3. 2 Thanks to mac_shinobi:

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

  4. #3

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    114
    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

  5. #4

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,216
    Thank Post
    2,767
    Thanked 935 Times in 875 Posts
    Rep Power
    343

  6. 2 Thanks to mac_shinobi:

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

  7. #5

    Join Date
    May 2006
    Location
    West Bromwich
    Posts
    2,184
    Thank Post
    299
    Thanked 211 Times in 181 Posts
    Rep Power
    55
    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?

  8. #6


    Join Date
    Sep 2007
    Location
    UK
    Posts
    5,135
    Thank Post
    1,307
    Thanked 808 Times in 513 Posts
    Rep Power
    632
    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.

  9. #7

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

  10. #8


    Join Date
    Feb 2007
    Location
    51.405546, -0.510212
    Posts
    8,123
    Thank Post
    203
    Thanked 2,388 Times in 1,768 Posts
    Rep Power
    703
    @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

  11. 2 Thanks to Arthur:

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

  12. #9

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    114
    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?

  13. #10

    Join Date
    May 2006
    Location
    West Bromwich
    Posts
    2,184
    Thank Post
    299
    Thanked 211 Times in 181 Posts
    Rep Power
    55
    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?

  14. #11
    zag
    zag is offline
    zag's Avatar
    Join Date
    Mar 2007
    Posts
    3,530
    Thank Post
    815
    Thanked 380 Times in 317 Posts
    Blog Entries
    12
    Rep Power
    80

  15. Thanks to zag from:

    sparkeh (8th January 2013)

  16. #12

    Little-Miss's Avatar
    Join Date
    Oct 2007
    Location
    Birmingham
    Posts
    5,350
    Thank Post
    2,330
    Thanked 623 Times in 419 Posts
    Blog Entries
    2
    Rep Power
    508
    Wait...i can schedule SIMS to the report for me?! How?! (I dont know the ins and outs of SIMS)

  17. #13

    Join Date
    Mar 2011
    Location
    Bournemouth
    Posts
    280
    Thank Post
    16
    Thanked 74 Times in 64 Posts
    Rep Power
    21
    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.

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

  19. #15

    Join Date
    Mar 2011
    Location
    Bournemouth
    Posts
    280
    Thank Post
    16
    Thanked 74 Times in 64 Posts
    Rep Power
    21
    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
  •