by TomK2 at 2012-09-20 00:06:21
Hi Newsgroup,by RichardSiddaway at 2012-09-20 03:02:22
I’m a newbie here.
I try to call an Exchange 2010 Powershell command with Invoke-Command, but I always get the following error message:
Value cannot be null.
Parameter name: serverSettings
+ CategoryInfo: NotSpecified ( [Get-MailboxDatabase], ArgumentNullException
+ FullyQualifiedErrorId : System.ArgumentNullException.Microsoft.Exchange.Management.SystemConfigurationTasks.GetMailboxDatabase
Get-MailboxDatabase normally needs no parameters. Other Exchange Powershell commands return the same error message.
The call of the command is the following:
invoke-command -computername ‘dummy-server’ -scriptblock { add-pssnapin ‘Microsoft.Exchange.Management.Powershell.E2010’; get-mailboxdatabase }
Thank you for any help.
Thomas
If you run the scriptblock on the remote server does it work?by TomK2 at 2012-09-20 03:45:57
also check the contents of exshell.psc1 and remote-exchange.ps1 to see if you need anything else
Hi Richard,by TomK2 at 2012-09-20 04:23:39
thanks for your answer.
if I run the scriptblock with Invoke-Command on the Exchange Server, it gives the same error message.
If I call only Get-MailboxDatabase on the Exchange Server (without Invoke), it works (lists one test database).
Thomas
Hi Richard,by mjolinor at 2012-10-09 08:22:23
in our exshell.psc1, the PSVersion is 1.0 (should this be 2.0 ?), the PSSnapin is "Microsoft.Exchange.Management.Powershell.E2010"
What are the important settings in remote-exchange.ps1 ? - this file seems to be ok.
Thomas
You need to connect to one of the Exchange management sessions, not a generic PS session.
$EX = new-pssession -configurationname Microsoft.Exchange -ConnectionURI http://<Exchange Server Name>/powershell/ -authentication kerberos
Invoke-Command -ScriptBlock {get-mailboxdatabase} -Session $EX