I'm scipting some new account creations via the new-mailbox cmdlet and this works fine however, when I try to connect to the AD account to add the remaining properties (these don't exist in New-Mailbox) my script merely creates the account and the email portion and ends. I receive no error messages. I thought feeding get-aduser the pipeline variable might be the issue however I was able to replicate this in a small test script and it worked fine. Any help would be greatly appreciated.

Etc. You might also put some code in there to make sure $_ contains what you think it does by that point.

by brycspain at 2012-12-21 06:34:38

Thanks for your attention on this Don. You book writing guys play chess when you're scripting and guys like me play checkers =) Regardless, my approach should still obtain the results I need. I went ahead and changed up the script per your suggestion (nice use of set-aduser) and I received the exact same results. AD Account and Email get created and nothing else...no error messages, etc. Could there be some disconnect with the Activedirectory module since I am importing the new-mailbox cmdlet with this snippet?

Is there maybe a better way of creating the email and AD account at the same time perhaps?

by RichardSiddaway at 2013-01-03 10:37:36

I've found in the past that creating the account and then the mailbox can cause problems if Exchange uses a different DC to the one you are connected to. If the new account hasn't replicated you will get problems. Ensure you are connected to the DC that Exchange is using or put a delay in your script (start-sleep) between the account creation and the mailbox creation