• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6178
  • Last Modified:

Exchange 2010 Powershell: Get-Mailbox "No provisioning handler installed"

I have an elusive problem.  I am using a PowerShell script to modify the SMTP Addresses of over 90 users.  I don't want to do this manually (I hear carpal tunnel sucks).

Important information:
AD Domain Controller(s) Platform: Windows Server 2008 SP2 (2008 Native Domain)
Exchange Server 2010:  Windows Server 2008 SP2 (separate form DC -- serving all Exchange roles)
PowerShell:  V2.0 run from Windows7 64-bit workstation running ADRMT
Here is my script, and the resulting output:

Import-Module ActiveDirectory

if (-not (Get-PSSnapin | Where-Object {$_.Name -like "Microsoft.Exchange.Management.PowerShell.E2010"}))
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

$pass = ConvertTo-SecureString 'xxxxxxx' -AsPlainText -Force
$Creds = new-object -typename System.Management.Automation.PSCredential -argumentlist "xxxxxx\Administrator",$pass

$results = Get-ADUser -Filter "*" -SearchBase "OU=Users,DC=mylocal,DC=lan"

foreach($result in $results){

$ident = "mylocal\" + $result.sAMAccountName

    <#$Mailboxes = get-mailbox -OrganizationalUnit "OU=users,DC=CCBBC,DC=LAN" -ResultSize Unlimited#>
    $Mailbox = get-mailbox -Credential $Creds -DomainController "mydc.mylocal.lan" -identity $ident

        $Mailbox.primarysmtpaddress = ($result.sAMAccountName + "@group.mylocal.edu")

    set-mailbox -Identity $result.sAMAccountName -Linkedcredential $Creds -PrimarySMTPAddress $Mailbox.primarysmtpaddress


Open in new window

However, when it gets to the "Set-Mailbox" command, I get the following output:
Set-Mailbox : No provisioning handler is installed.
At C:\ChangeEmail.ps1:25 char:16
+     set-mailbox <<<<  -Identity $result.sAMAccountName -Linkedcredential $Creds -PrimarySMTPAddress $Mailbox.primarysmtpaddress
    + CategoryInfo          : NotSpecified: (:) [Set-Mailbox], InvalidOperationException
    + FullyQualifiedErrorId : 771ED1AB,Microsoft.Exchange.Management.RecipientTasks.SetMailbox

Does anyone have any ideas?
1 Solution
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
What credentials are used to run the script ? Is the Account member of Recipient Org and Domain admins group and has Exchange Org admin rights as well ?

Did you try running the command from the Exchange server ?

- Rancy
Check the credential before your run the script, you can use ADModify tool to do the bulk changes on single attmpt, i was using the same, it is useful tool
Why not use ADMODIFY ? It is a GUI based tool, so you'd know which accounts are getting modified with results of it shown in the GUI.


QuantifiableAuthor Commented:
Okay, I know much acclaim has been given to ADModify, so I tried it.  For the most part, it did what I wanted it to, but it totally screwed me on 12 users.  I actually have to delete their mailboxes and re-enable them.  It took their email addresses out completely and left the users with blank data. All the other users were set just fine.  

That's too much uncertainty for me.  So, while ADModify may work flawlessly for everyone else, I can't mark that as the accepted solution.  I now have 12 users I have to re-create.  When I checked the user's mailbox properties and it populated with default data, it also told me there was no primary SMTP address (even after setting the reply address) and it won't let me save it.  Everyone else seems fine.

I went ahead and tried the "Set-Mailbox" command on the Exchange server for one user.  It worked fine (without credntials).  It was obviously a permissions issue at this point.  I'll mark you as the accepted solution.  I can't run the full script on the Exchange server because it is running 2008 SP2 and not R2.  So, I can't access the AD module.  I'll just take the user list I have, put it in Excel, and fill-down.  Then all I'll have to do is cut-and-paste from the Exchange PS on the server.

Thank you everyone for the help.

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now