Datasheet
Part I: PowerShell for Exchange Fundamentals
22
Most shells offer some form of automatic completion to take some of the drudgery and guesswork out of
entering certain command elements. Even
cmd.exe offers automatic completion using the tab key when
typing directory paths and filenames. Windows PowerShell takes this feature to whole new levels of
functionality by providing tab expansion of cmdlet and parameter names as well.
To use tab expansion when typing a cmdlet name, simply type the verb name followed by the hyphen,
then the first few letters of the noun name. When you press the Tab key, Windows PowerShell
automatically expands what you entered to the first matching cmdlet name. If there are other possible
matches, pressing the Tab key repeatedly cycles through the available choices. Pressing the Tab key
while holding down the Shift key causes Windows PowerShell to cycle backwards through the available
choices. The more characters you enter before pressing the Tab key make the search more specific and
narrows the number of possible matches.
For example, say you need to run the cmdlet
Get-MailboxFolderStatistics . This cmdlet is useful
for determining the size and number of items in given mailbox folders. Using tab expansion you can
enter this long cmdlet name with no mistakes and a minimal number of keystrokes using the following
procedure:
1. Type get-ma and press the Tab key. This expands to Get-Mailbox . Notice the name
automatically changes to the standard form of uppercase first letters.
2. Now press the Tab key a second time. This time the cmdlet name expands to
Get-MailboxCalendarSettings .
3. Press the Tab key again and the name expands to Get-MailboxDatabase .
4. Press the Tab key one last time to expand the name to Get-MailboxFolderStatistics .
To continue at this point simply hit the space bar and continue typing the rest of the command.
Figure 1-17
c01.indd 22c01.indd 22 12/17/07 3:19:29 PM12/17/07 3:19:29 PM