New
to Exchange Server 2010 is the ability to access all the familiar
Exchange Server cmdlets remotely, leveraging the PowerShell v2 remote
capabilities. This enables cmdlets and scripts to run across multiple
servers in a single EMS instance. It also enables administrators to run
the shell from their workstation and connect remotely to the Exchange
Server 2010 servers. Given the limitation of the EMC to run only on
64-bit systems, the EMS also enables 32-bit clients to connect to the
servers.
Supported client OS platforms for the EMS are the following:
The software requirements for the EMS are as follows:
Windows PowerShell v2
WinRM 2.0
The remote EMS does not require any Exchange Server binaries to be installed on the client, making deployment much easier.
The New-PSSession and the Import-PSSession cmdlets establish a remote session. The New-PSSession
cmdlet establishes a secure persistent connection to the remote
computer. A number of security options to the command support a variety
of authentication and transmission options. The Import-PSSession
cmdlet imports commands such as cmdlets, functions, and aliases from
the remote computer into the local client. This includes all the
Exchange Server 2010 cmdlets. The imported commands actually run in the
remote session—that is, on the remote Exchange Server 2010 server rather
than the local client.
To access an Exchange Server 2010 server from another system using the remote shell, execute the following commands:
1. | Launch PowerShell.
|
2. | Execute the cmdlet $UserCredential = Get-Credential. This prompts for credentials to use with the shell and store them in the variable.
|
3. | Execute the cmdlet $Session
= New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri
http://EX1.companyabc.com/PowerShell/ -Credential $UserCredential.
Make sure to replace the FQDN of the target server in this example. This
cmdlets establishes a connection with the Exchange Server 2010 server.
|
4. | Execute the cmdlet Import-PSSession $Session. This imports the server-side session from the Exchange Server 2010 server.
|
Exchange Server 2010 commands can now be executed remotely. Figure 1 shows an example of a remote session connection and the execution of a sample Get-Mailbox cmdlet executed from the remote system.
The preceding example was executed on a 32-bit Windows Vista system running WinRM 2.0 and PowerShell v2.
The
certificate requirement can be bypassed using the SkipCACheck,
SkipCNCheck, and SkipRevocationCheck options. These are a little tricky
to generate because the options need to be stored in an object prior to
executing the cmdlet. Here are the steps:
1. | Launch PowerShell.
|
2. | Execute the cmdlet $SkipCert = New-WSManSessionOption -SkipCACheck -SkipCNCheck –SkipRevocationCheck. This captures the option to skip the certificate check in the $SkipCert variable.
|
3. | Execute the cmdlet $UserCredential = Get-Credential. This prompts for credentials to use with the shell and store them in the variable $UserCredential.
|
4. | Execute the cmdlet $Session
= New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri
http://EX1.companyabc.com/PowerShell/ -Credential $UserCredential
-SessionOption $SkipCert. Make sure to replace the FQDN of the
target server in this example. This cmdlets establishes a connection
with the Exchange 2010 server.
|
5. | Execute the cmdlet Import-PSSession $Session. This imports the server-side session from the Exchange 2010 server.
|
To get help with remote operations in PowerShell, use the get-help about_Remote_Troubleshooting command. This has extensive troubleshooting information and helpful tips. Use get-help New-PSSession to get help on the New-PSSession cmdlet, which includes quite a few options.