Wednesday, January 12, 2011

Referencing And Understanding What PowerShell Commands Are Being Used In Exchange 2010

A little background…Exchange 2010 management is built completely on top of PowerShell.  The Exchange Management Console (EMC) is just a fancy GUI to run powershell commands underneath the covers.  While you can get a lot accomplished in the EMC, not all management functions are available in the EMC.

What I want to go over in this post is to learn not only what commands that the GUI is running in the background, but also how to reference past commands that have been executed. 

First let’s focus on the Exchange Management Shell (EMS):

This section is not to tell you how to use the EMS, just some tips to on using the EMS to reference past commands.

  • Keyboard Command: F2 – Enables a pop-up screen with your last command that was run and ask to enter in a character.  Powershell will then create a new command using the last entered command up to the character specified.

EXCHPS - F2

  • Keyboard Command: F7 – Enables a pop-up screen with the last 50 commands used in the current session and allows you to select a command to reuse.

EXCHPS - F7

  • Keyboard Command: F8 – Moves backward through the command history
  • Keyboard Command: Up/Down – Moves up and down through the history of previous commands

Now let’s focus on what is available in the Exchange Management Console (EMC):

There are three main ways to see what PowerShell commands are being run or have been run.

  • Modifying Properties – When modifying properties in a dialog box, a powershell icon will light up.  When selected you can see exactly what command will be run when you click “apply”.

EXCHPS - prop button - markup

EXCHPS - prop button - opened

  • Performing an action – When performing an action like a mailbox move or creating a connector, the command will be displayed that was used to perform that action.

EXCHPS - new command

  • Viewing the EMS Log – by selecting “View Exchange Management Shell Command Log…” from the EMC View menu, you can view a history of commands that have been run since the session was created.

EXCHPS - menu log

EXCHPS - menu log - open

Hopefully the tips above will help facilitate learning powershell commands for Exchange so reliance on the EMC is not necessary.

No comments:

Post a Comment