Programmatically add/delete users in Exchange
- by Terry Gamble
I've got the following set up:
ASP.Net site that allows my internal employees to add in new hire information (no secure data, just stuff like name/address/phone) and when they submit this it goes into a database (SQL).
Every few minutes a service runs that checks the database and if there are new entries it will add them into Exchange. The issue is I'm not happy with the way the service is doing things, (It's not putting address, etc in it). As I don't have the source code this I'm thinking of recreating it.
My issue though is finding a starting point even. I know I'll have to create the scripts through code where the data is retrieved from SQL :
Joe Smith
123 Main Street
Nowhere, USA 19999
And put that into a powershell cmdlet (not sure exactly the syntax but I can get that figured out unless someone already has it) where the user is created in the Active Directory as a normal user and the mailbox is created simultaneously.
From there I just need to fill out fields in Active Directory with the person's address, etc.
Finally a deletion routine for when we terminate someone, however I'm sure that it will simply be a cmdlet that is easily shelled out to much like the initial one is, once I can figure out how to start that...
Anyone have some good reference points or have already done it and can share?