Recently one of my dear friend asked me about a question ::: Adding a particular field for as a SMTP address for newly created users automatically.

Did I Just say Friend :) He is our PFE Akshay

Well I talked about the cmdletextension agents with him and I also liked the Idea

Then we had a great discussion about the same and then we sat in our labs to see if this is really possible.

Eureka we were able to achieve the same.

Before We talk about how we achieved it, please go through the following article about cmdletextensionagents http://technet.microsoft.com/en-us/library/dd335054(v=exchg.150).aspx

Now lets see how we did we do it

We wanted to have the Pager attribute value to be populated as the additional email address

<?xml version="1.0" encoding="utf-8" ?>

<Configuration version="1.0">

<Feature Name="MailboxProvisioning" Cmdlets="enable-mailbox">

  <ApiCall Name="OnComplete">

   if($succeeded)    {

$user = (Get-User $provisioningHandler.UserSpecifiedParameters["Identity"]).distinguishedName

set-mailbox -identity $user -emailaddresspolicyenabled $false

$a=get-mailbox $user | Get-User | select pager

write-host $a

write-host $a.pager

$b=$a.Pager+ "@wingtiptoys.com"

$c=Get-Mailbox $user

$c.EmailAddresses+="$b"

Set-Mailbox -identity $user -EmailAddresses $c.EmailAddresses

   }

  </ApiCall>

</Feature>

</Configuration>

I would strongly recommend you to go ahead look at the http://www.ehloworld.com/194 blog about where and how to enable which scripting agent.

Thanks a lot Akshay.

Naveen Vasudevan