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

Posted on 2012-08-10
Last Modified: 2012-08-11
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 + "")

    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?
Question by:Quantifiable
    LVL 52

    Accepted Solution

    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
    LVL 2

    Expert Comment

    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
    LVL 33

    Expert Comment

    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.


    Author Closing Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Integrate social media with email signatures

    Is your company active on social media? Do you also use email signatures? Including social media icons in your email signature is a great way to get fans for free. Let all your email users know you’re on social media quickly and easily, in a single click.

    Set OWA language and time zone in Exchange for individuals, all users or per database.
    "Migrate" an SMTP relay receive connector to a new server using info from an old server.
    In this video we show how to create a Contact in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Contact ta…
    The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now