Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Yet another AD bulk script problem

$
0
0

Seems to be a common topic in these parts, but forgive me as I went way over my head with this. I haven't done much powershell scripting in the past and I'd appreciate any help I could get with this.

I've been looking at various different bulk AD account creation scripts, but they weren't quite what we were looking for. So I decided to try and make a new one, using those scripts as an example. Honestly, I'm stumped.

My CSV is like this

First name;Last name;Title;Department;Company;Manager;Office;Telephone number;Mobile phone number;E-mail;Country;City;Street address;Postal code;Home folder;Application 1;Application 2;Application 3
John;Doe;System specialist;Access & Identity Management;Company A;Boss Man;;;123 123 123;Yes;USA;Citysomewhere;Somestreet 3;11111;Yes;No;Yes;No
Jane;Doe;Accountant;Financials;Company B;Boss Lady;;;321 321 321;Yes;USA;Somecity;Somestreet 24;22222;Yes;Yes;No;No

Intention is that we have Excel sheet customer can fill out with as many people as they want and then send it back. We would then convert the Excel sheet to a csv file, output example above.

As you can see, it does not have any information about user account naming, OU or password. The script was supposed to handle that based on information in the csv. Another problem is that not all fields are required. The only required fields are obviously what is needed to create a basic account, everything else is optional information.

In my frankenstein of a script I am way too embarrassed to show anyone at this point, I was trying to do following things:

- Company field sets the OU in where each user account will be created.
- Give user sam based on 5+2 naming policy. If that is already in use, then 5+3. If even that is in use, then 4+4.
- Random password given and logged along with user's name, manager and phone number.
- Set manager field in AD.
- Create new exchange mailbox or home folder if appropriate field is set to Yes, otherwise skip.
- Give permissions to applications with appropriate AD-groups if Yes.

As you can see, the goal was little big. I've begun to wonder if this is even reasonably possible to accomplish with straightforward powershell scripting, or if we're already in the realm of a real AD-management application.

These are the scripts I was looking at to help me with building this script:

http://gallery.technet.microsoft.com/office/AD-and-mailbox-from-CSV-96a4713f
http://gallery.technet.microsoft.com/scriptcenter/PowerShell-Create-Active-7e6a3978
http://gallery.technet.microsoft.com/scriptcenter/ed20b349-9758-4c70-adc0-19c5acfcae45
http://blogs.msdn.com/b/amitgupta/archive/2012/02/06/creating-bulk-users-in-active-directory-using-powershell.aspx

I thought it wouldn't be too hard since there are already many similar scripts I can use, boy was I wrong. None of the scripts were as involved as our goal is and I am beginning to understand why.

So right now I'd like to know, is our goal unreasonable to achieve with just powershell scripting? If yes, then we'll have to see what our options are. If no, then would any one you kind souls be willing to give a hand at this? I'm way over my head here.

Thank you very much for any and all help in advance.


Viewing all articles
Browse latest Browse all 6937

Trending Articles