Understand, Run, and Use the Exchange Managemen...
Tip: Understand, Run, and Use the Exchange Management Shell

After you’ve installed the Exchange management tools on a computer, you can start to use the Exchange Management Shell by clicking Start, pointing to All Programs, clicking Microsoft Exchange Server 2010, and then clicking Exchange Management Shell.

Selecting the shell in this way starts the Exchange Management Shell using your user credentials. This enables you to perform any administrative tasks allowed for your user account. As a result, you don’t need to run the Exchange Management Shell in elevated, administrator mode, but you can. To do so, right-click Exchange Manage¬ment Shell, and then click Run As Administrator.

This starts PowerShell and loads the Exshell.psc1 console file and the Remote¬Exchange.ps1 profile file. These files are used to initialize the working environment for Exchange Server. The console file loads the Microsoft.Exchange.Management.PowerShell.E2010 snap-in. The profile file sets aliases, initializes Exchange global variables, and loads .NET assemblies for Exchange. It also modifies the standard PowerShell prompt so that it is scoped to the entire Active Directory forest and defines the following Exchange-specific functions:

Functions
Allows you to list all available functions by typing functions.

Get-Exbanner
Displays the Exchange Management Shell startup banner whenever you type get-exbanner.

Get-Exblog
Opens Internet Explorer and accesses the Exchange blog at Microsoft whenever you type get-exblog.

Get-Excommand
Allows you to list available Exchange commands by typing get-excommand.

Get-Pscommand
Allows you to list available PowerShell commands by typing get-pscommand.

Get-Tip
Displays the tip of the day whenever you type get-tip.

Quickref
Opens Internet Explorer and allows you to download the Exchange Management Shell quick start guide whenever you type quickref.

The RemoteExchange.ps1 profile loads the ConnectFunctions.ps1 script, which defines a number of functions that enable AutoDiscover and Connect features. The functions include the following:
  • Connect-ExchangeServer
  • Discover-ExchangeServer
  • _AutoDiscoverAndConnect
  • _CheckServicesStarted
  • _ConnectToAnyServer
  • _GetCASServers
  • _GetExchangeServerInSite
  • _GetHostFqdn
  • _GetHubMailboxUMServers
  • _GetMetabases
  • _GetServerFqdnFromNetworkAddress
  • _GetSiteAndForest
  • _GetURL
  • _OpenExchangeRunSpace
  • _PrintUsageAndQuit
These functions are available for you to use at this point as well as whenever you work with the Exchange Management Shell or have loaded the ConnectFunctions.ps1 script. However, only Connect-ExchangeServer and Discover-ExchangeServer are meant to be called directly. The other functions are helper functions. When you are working with the Exchange Management Shell or have run ConnectFunctions.ps1, you can view the source for a function by typing functions followed by the name of the function, such as functions connect-exchangeserver.

From the Microsoft Press book Microsoft Exchange Server 2010 Administrator’s Pocket Consultant by William R. Stanek.



Page view tracker