Hello,
I'm trying to run a command (Get-MailboxStatistics) remotely via Powershell. It targets to return every user-mailbox on the exchange server including the size of the mailbox.
When I try to run:
Get-MailboxStatistics -Server exchangeserver | sort TotalItemSize | FT DisplayName, TotalItemSize
Directly on the server in the Exchange Shell it does exactly what I want.
But as soon as I try this from a remote Computer:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://exchangeserver/PowerShell/ -Authentication Kerberos Import-PSSession $Session -CommandName Get-MailboxStatistics Get-MailboxStatistics -Server srv02exchange | sort TotalItemSize | FT DisplayName, TotalItemSize Remove-PSSession $Session
I get the error:
Es wurde kein Parameter gefunden, der dem Parameternamen "Server" entspricht.
+ CategoryInfo : InvalidArgument: (:) [Get-MailboxStatistics], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Get-MailboxStatistics
+ PSComputerName : exchangeserver
(No Parameter found, that equals the parameter name "Server".)
The same thing happens when I use Invoke-Command, it doesn't matter if I use a temporary session or import a session.
Any suggestions?
I'm totally new to the Powershell, maybe it's just something really simple..
TIA