I’m trying the following after I have startet a new “Import-PSSession $Session”
<pre class=“lang:ps decode:true”>$sb = {(Get-MailboxStatistics -Identity $Mailbox.Alias).TotalItemSize.value.ToBytes()}
[int]$MailboxSize = Invoke-Command -Session $session -ScriptBlock $sb
But I get the error that Identity is empty.
How can I pass the content of the variable with the invoke command?
Or another way of putting it, what am I doing wrong?
PS M:\SkyDriveBackup\SkyDrive\BackupScripts> [int]$MailboxSize = Invoke-Command -Session $session -ScriptBlock $sb -ArgumentList powerShell
Cannot bind argument to parameter ‘Identity’ because it is null.    + CategoryInfo         : InvalidData: ( [Get-MailboxStatistics], ParameterBindingValidationException    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Get-MailboxStatistics    + PSComputerName       : 4twexbe1