4. Remote PowerShell
As I keep saying (I'll stop
soon), the Remote Shell is new in Exchange Server 2010, making it
possible to connect to an Exchange Server 2010 server at a remote
location. The workstation doesn't have to be in the same domain or even
have the Exchange Management Tools installed – as long as the proper
credentials are used, it will work. With this kind of functionality,
it's now as easy to manage your Exchange Servers in another part of the
building as your Exchange Server in a datacenter in another part of the
country.
When the Exchange Management Shell is opened via Start Menu> All Programs> Exchange Server 2010,
the Exchange Management Shell will automatically connect to the
Exchange Server 2010 you're logged on to. But using the remote options,
it's also possible to connect to a remote Exchange Server at this stage.
To use the Remote Shell, you'll
need to log on to a Windows Server 2008 (R2) server or Windows 7
workstation that has the Windows Management Framework installed. The
Management Framework consists of PowerShell 2.0 and Windows Remote
Management (WinRM) 2.0, and can be downloaded from the Microsoft
website: HTTP://TINYURL.COM/POWERSHELL2
Make sure that the workstation
(or server) supports remote signed scripts. Due to security constraints,
this is disabled by default. You can enable this support by opening a
Windows PowerShell command prompt and entering:
The next step is to create a
session that will connect to the remote Exchange Server. When the
session is created it can be imported into PowerShell:
The PowerShell on the
workstation will now connect to the remote Exchange Server using a
default SSL connection and, RBAC-permitting, all Exchange cmdlets will
be available. It's incredibly easy.
To end the remote PowerShell session, just enter the following command:
Admittedly, the above example
is from a server that's also a member of the same Active Directory
Domain. To connect to a remote Exchange Server 2010 server that's
available over the Internet, multiple steps are required. The first step
is to create a variable in the PowerShell command prompt that contains
the username and password for the remote session:
A pop-up box will appear,
requesting a username and password for the remote Exchange environment.
Once you've filled in the credentials, the following command will create
a new session that will setup a connection to the Exchange environment.
The $Credential variable is used to pass the credentials to the
Exchange environment, and then the session is imported into PowerShell:
NOTE
If
you want to connect to a remote Exchange Server 2010 server over the
Internet you have to remember to enable Basic authentication on the
remote server. Open the Internet Information Services (IIS) Manager on
the server, navigate to the Default Website and select the /PowerShell
Virtual Directory. In the results pane, under IIS double-click on
Authentication. Here you can enable Basic Authentication.
The examples were for the
Active Directory Domain Administrator, who automatically has the remote
management option enabled. To enable another user for remote management,
enter the following command: