Exchange Powershell -asjob

trying to get a list of mailboxes and their sizes. Got a script but it takes a very long time to run on the environment of 40000+ users. I’m checking on a method to have each server get their own users and sizes and run it as a job. For some reason the below is not working. Any idea ? (i know about the implicit remoting, interested on how to run Exchange commands as powershell jobs)

Invoke-Command {
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
. $env:ExchangeInstallPath\bin\RemoteExchange.ps1
Connect-ExchangeServer -auto
get-mailbox} -asjob -computer Servername

Because you can’t remote into an Exchange machine in that manner. You have to create a PSsession to the Exchange PowerShell URI and import the session. Alternatively install the Exchange admin tools on your admin machine

To create an session to an Exchange box and import the cmdlets
$sess = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri “http://<servername>/PowerShell” -Authentication Kerberos -Credential $cred -ErrorAction Stop

You may be able to leave out the credential

import the session like this
Import-PSSession $sess

Ok. I’m interested to run “Get-Mailbox” on multiple servers in parallel (preferably using Powershell jobs).
Any idea how to do that ?

I suspect that the best way to do it is to install the Exchange admin tools on your local machine. Each job will have to install the Exchange snapin (jobs run in a separate PowerShell process) and run the command against the appropriate server

thanks. If you have time to post a quick example would be very helpful.

All i’m trying to do is have each mailbox server get the mailboxes and their sizes (in parallel) than my computer doing all the work.
It takes almost 2 days for the script to run from my computer.