Because a command running on 1 computer is taking way too long to finish I would like to create a brand new command that will run simultaneously on all 5 computers. I think the invoke command is perfect for this scenario.
This is what I would like to accomplish:
$servers=Get-TransportService | select -ExpandProperty name
foreach ($server in $servers) { Invoke-Command -ComputerName $server -FilePath .\MessageTrackingLog.ps1 }
#MessageTrackinglog.ps1 contains the following
Add-PSSnapin Microsoft.Exchange.Management.Powershell.E2010
Get-MessageTrackingLog -Start “09/07/2017 12:00 AM” -End “09/08/2017 12:00 AM” -ResultSize Unlimited |
Where {$_.MessageLatencyType -eq “EndToEnd” -And $_.MessageLatency -gt “00:02:00”} |
Select MessageLatency,Sender,MessageId |Sort-Object -Property MessageLatency -Descending |
Export-Csv C:\locationtosave\MessageTrackingResults.csv
#Problem is that t is taking the same amount of time.
#Help please