Go Premium for a chance to win a PS4. Enter to Win

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1450
  • Last Modified:

Remote Powershell - Microsoft.Exchange.Management.PowerShell.E2010?


When connecting remote to our Exchange server using Powershell - I get the following error: (New-Mailbox)

New-PSSession myex01

 Id Name            ComputerName    State    ConfigurationName     Availability
 -- ----            ------------    -----    -----------------     ------------
  1 Session1        myex01          Opened   Microsoft.PowerShell     Available

Enter-PSSession 1
[myex01]: PS C:\> Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

[myex01]: PS C:\> New-Mailbox xxx4 -shared -UserPrincipalName xxx4@mydomain.local

Value cannot be null.
Parameter name: parameters
    + CategoryInfo          :
    + FullyQualifiedErrorId : System.ArgumentNullException,Microsoft.Exchange.

2 Solutions
Hmm, not sure why you are creating a remote powershell session and then importing the exchange 2010 snapin as well?

If I want to get around the stupid concurrent pipeline error I sometimes get with remote powershell I then import the snapin to windows powershell and that then works for me.

I assume you've checked the values tab in OK? If you run just New-Mailbox and don't enter anything else does it ask you for the values to be entered?

PowerShell with Exchange 2010 supports remote commands anyway, this is a fairly typical remote exchange powershell setup I use:

#Function to dynamically open sessions to E14 Servers
Function Open-Session
	$ServerList = "Server1.FQDN", "Server2.FQDN", "Server3.FQDN"
	for ($i = 0 ; $i -lt $ServerList.Count ; $i++)
		$ConnectionURI = "http://" + $ServerList[$i] + "/powershell/?SerializationLevel=Full"
		write-host $ConnectionURI
		$Session = New-PSSession -ConfigurationName Microsoft.Exchange –ConnectionUri $ConnectionURI –Authentication Kerberos
		Import-PSSession $Session
		if ($Session)
			write-host "Session Established"
			return $Session


#Connect to Exchange 2010 with Remote Powershell
$Session = Open-Session

##### Run Commands Here #####

#Cleanup Session
[string]$SessionID = $Session | % {$_.InstanceId.guid}
$SessionID = $SessionID.Trim()

Remove-PSSession -InstanceID $SessionID

Remove-Variable -Name "SessionID"

Open in new window


Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Tackle projects and never again get stuck behind a technical roadblock.
Join Now