RemoteSessions â€“ Pipelining

Hello everyone.

I support Office 365 so someone that deals specifically with RemoteSessions, I would appreciate any input!
I have thousands of mailboxes to monitor.
I have encountered issues with throttling from the ‘PowerShell with Exchange Service’ attempting to collect large amounts of data (read: all attributes from all mailboxes).

I am wondering if someone than lob some ideas out there to get me thinking about approaching this a different way.

Does anyone have general recommendations for the following:
1 - How do you monitor if your PowerShell session disconnects?
This obviously breaks the pipeline. This is super-lame if executing something like: Get-Mailbox -ResultSize Unlimited

2 - How can you pick up from a command if you were disconnected/pipeline gets throttled?
I am writing various Try{}Catch{} wrappers, mostly unsuccessfully.
Example: Get-Mailbox -ResultSize Unlimited

Another thing revolving around this, WMF/PowerShell 4.0/Windows 8.1 don’t seem to be getting along at the moment: Things like -ErrorAction ‘Stop’ are ignored from the Exchange command-lets.

3 - How do you work with a ‘large’ pipeline across a remote session reliably?
Example: Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Export-CSV ‘C:\Path\To\Export.csv’ -NoTypeInformation
Official help ( says to add a | foreach in there, but same results. Command tends to choke and you lose what you partially collected.

4 - How do you work with throttling? Can you create yourself a “bookmark” and resume from that?

Thanks for any suggestions.

O365 and Exchange do put some throttles in place to protect the system - you kind of have to “chunk” your workload so you’re only working with a few things at a time.

1 - You can monitor the state of the PSSession object, but that’s something you have to check. I don’t think it fires an event when it disconnects, although there might be something you could tap into. Moral: Don’t do -ResultSize Unlimited. Find a way to break the workload into pieces, like grabbing “A-C” then “D-F” and so on.

2 - I’m not sure what you mean by “pick up from a command.” If you mean resume it, you can’t. And yeah, the Exchange cmdlets are known to be funky with -ErrorAction. No fixing that.

3 - Break it into chunks. Don’t try and grab everything all at once; grab it in pieces and then assemble the pieces on your end. The back-end isn’t going to let you do what you’re trying to do.

4 - You work with a small enough set that you won’t get cut off. There’s no pick-up-where-you-left-off, no. The back-end has to spend enormous processing power handling things like what you’re trying to do, and it doesn’t want to do that. You’re not the only one using it, after all. So you have to structure your workload to be smaller sets.

Hi Don! Thanks for the reply.

What’s your opinion about a PowerShell workflow for this scenario?

Something you wrote: ->