A Blog on Wndows Server and Microsoft Exchange by Thomas Pätzold

Archive for December 2010

Start the Microsoft Exchange 2010 Shell

leave a comment »

Since Exchange 2007 Windows Powershell is used in order to administer the Microsoft Exchange environment. In order to use the shell you start the Exchange Management shell. It looks like

Exchange 2010 Shell

In some scenarios it might be useful to be able to start the Exchange shell without the verbose messages indicating to whitch Exchange Server the shell is connected to. In order to do this you have to load the Exchange Shell extensions in a normal Windows Shell Session. In order to do this you have to run the following commands in the PowerShell:

$s = new-pssession -configurationname -connectionuri "" -authentication Kerberos
$warningpreference = "SilentlyContinue"
Import-PSSession $s 2>&1 | out-null

Now we look a litte bit further. The variable $warningpreference defines what happens if a script uses the write-warning cmdlet in order to make some output. If you set this variable to the value of silentlycontinue the output is suppressed. The default of this variable is Continue whitch means that warningmessages are displayed in yellow color on the console. If you want to get more details on preference variables you can read the PowerShell help

get-help about_preference_variables 

But what does 2>&1 mean? It´s the redirect for the standard error output.  The Standard error is redirected to the standard output and everything is redirected to out-null. So nothing will be shown in the end and the Powershell with Exchange extensions looks like.

Now you are able to use 626 Exchange 2010 Commands in your Powershell Session.


Written by Thomas Pätzold

December 30, 2010 at 5:29 pm

%d bloggers like this: