I am trying to setup a monitor that keeps track of the number of pending messages in the Exchange Online service. I can do this via PowerShell by connecting to Exchange Online:
$UserCredential = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection Import-PSSession $Session |
and running
(Get-MessageTrace - Status Pending).count. |
Is it be to use SAM's PowerShell monitor to write a script to do this and track the integer returned by the above command?