I'm trying to create an Exchange 2010 script that will search each transport server as a job. I try the following:
$transportserver = get-transportserver
foreach ($ts in $transportserver)
{
$ts_name = $ts.name
$s = New-PSSession -ComputerName $ts_name
Invoke-Command -Session $s -Script { Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010; Get-MessageTrackingLog -server $args[0] } -Args $ts_name
}
But I get the error:
Value cannot be null. Parameter name: serverSettings + CategoryInfo : NotSpecified: (:) [Get-MessageTrackingLog], ArgumentNullException + FullyQualifiedErrorId : System.ArgumentNullException,Microsoft.Exchange.Management.TransportLogSearchTasks.GetMessageTrackingLog
I've tried a few variations like adding more parameters but it returns the same error.
The script looks very simple, so i feel like your problem lays elsewhere. maybe try
If that fails maybe walk towards another solution, with psExec fx. This is just a quick copy/paste from my personal scripts.