Author Posts

September 18, 2013 at 7:39 am

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

September 18, 2013 at 7:48 am

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:///PowerShell" -Authentication Kerberos -Credential $cred -ErrorAction Stop

You may be able to leave out the credential

import the session like this
Import-PSSession $sess

September 18, 2013 at 8:14 am

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

September 18, 2013 at 8:19 am

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

September 18, 2013 at 8:26 am

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.