0

Exchange 2013 Tip Of The Day – 1 To 25

The Exchange Management Shell helps us discover the amazing capabilities of PowerShell.  One way it does this is by displaying a tip of the day so that we are introduced to concepts and topics that inevitably will come in handy one day!

The other Exchange 2013 tips of the day posts can be found here:

Exchange 2013 Tip Of The Day – 26 To 50

Exchange 2013 Tip Of The Day – 51 To 75

Exchange 2013 Tip of The Day – 76 To 93

Exchange 2010 tips can be found here and the  Exchange 2007 Tips are listed on TechNet.

To retrieve the tips listed in this post, this PowerShell code was used to retrieve them:

$Int = 1;While ($Int -le 25){Get-Tip $Int;  Write-Host; $Int+=1}

 

Please refer to the Exchange 2010 tips post for a more verbose version of the PowerShell code.

 

Just like the Exchange 2010 tips, the first four Exchange 2013 tips are also duplicated, though since they are randomly displayed it goes un-noticed!

 

 

Tip of the day #1:

Did you know that the Identity parameter is a "positional parameter"? That means you can use:

Get-Mailbox "user" instead of: Get-Mailbox -Identity "user"

It's a neat usability shortcut!

 

Tip of the day #2:

Did you know that the Identity parameter is a "positional parameter"? That means you can use:

Get-Mailbox "user" instead of: Get-Mailbox -Identity "user"

It's a neat usability shortcut!

 

Tip of the day #3:

Did you know that the Identity parameter is a "positional parameter"? That means you can use:

Get-Mailbox "user" instead of: Get-Mailbox -Identity "user"

It's a neat usability shortcut!

 

Tip of the day #4:

Did you know that the Identity parameter is a "positional parameter"? That means you can use:

Get-Mailbox "user" instead of: Get-Mailbox -Identity "user"

It's a neat usability shortcut!

 

Tip of the day #5:

Tired of typing a long command every time that you want to do something? Alias it! Type:

Set-Alias GetMre Get-ManagementRoleEntry

For all the current aliases, type:

Get-Alias

 

Tip of the day #6:

Want to see the members of a dynamic distribution group that has a custom filter? Just use the Get-Recipient cmdlet. Type:

$DDG = Get-DynamicDistributionGroup "Contoso Marketing Managers"
Get-Recipient -RecipientPreviewFilter $DDG.RecipientFilter

 

Tip of the day #7:

The Exchange Management Shell is a calculator, too! Try it directly at a command prompt:

1.2343+3123 or (23/435)*2

 

Tip of the day #8:

Command line SOS! Do you need help? Type:

Help <cmdlet-name>  or  <cmdlet-name> -?

You can choose what information to return when you view Help by using the Detailed, Full, and Examples switches:

Help Get-Mailbox –Detailed

 

Tip of the day #9:

Want to look at Help for a cmdlet but don't want to read through pages and pages of text in the Shell window? Just use the Online switch with the Get-Help cmdlet. The Online switch tells the Shell to open the online version of the cmdlet's Help topic in your default browser. Type:

Get-Help <cmdlet> –Online

 

Tip of the day #10:

The tilde character (~) should be familiar to Unix users. It represents the shortcut to your root directory. To see what it's evaluated to by default, type:

Dir ~

You can use it as a useful shortcut:

Cp SomeFile "~\My Documents"

 

Tip of the day #11:

CTRL+C is the equivalent of the hard-break command in the Exchange Management Shell. If a command is taking too long to run or you want to cancel an operation quickly, press CTRL+C to stop execution.

Tip of the day #12:

Pushd and Popd work the same way in the Exchange Management Shell as they do in cmd.exe. Type:

Pushd <location>

 

Tip of the day #13:

XML over everything! The Exchange Management Shell treats XML as a native type, so that you can do interesting things like:

$Sample = [XML](Get-Content SomeXMLFile.xml)

This command assigns $Sample to the actual XML object. To see it, type:

$Sample

To navigate, type:

$Sample.Prop1.Prop2

No need for text parsing when you want to load XML data!

 

Tip of the day #14:

Cmdlets that end in "Config" manage singleton configuration, either one per server or organization. For these tasks, you don't have to specify an identity because there is only one instance of the configuration. You may have to specify the Server parameter if the configuration is per server.

 

Tip of the day #15:

To get a list of all users on an Exchange 2013 server who aren't Unified Messaging-enabled, type:

$Mailboxes = Get-Mailbox
$Mailboxes | ForEach { If($_.UmEnabled -Eq $False){$_.Name}}

 

Tip of the day #16:

To get a list of all users on an Exchange 2013 server who are Unified Messaging-enabled, type:

$Mailboxes = Get-Mailbox
$Mailboxes = | ForEach { If($_.UmEnabled -Eq $True){$_.Name}}

 

Tip of the day #17:

To display the user's alias formatted in a table together with the user's Exchange 2013 server name and telephone extension, type:

Get-Mailbox | Format-Table ServerName,@{e={$_.SamAccountName};Label="User Alias"},@{Expression="Extensions";Label="Telephone numbers"}

 

Tip of the day #18:

To display the list of UM IP gateway server names disabled for outbound calling and hunt groups associated with a UM IP gateway server, type:

$Gateways = Get-UMIPGateway
$Gateways | ForEach {If($_.OutCallsAllowed -Eq $False){ "Gateway Name = " +$_.Name;ForEach ($HuntGroup In $_.Huntgroups ){"Huntgroups " + $Huntgroup}}}

 

Tip of the day #19:

If you want to test all IP Block List providers, you just have to pipe the Get-IpBlockListProvider cmdlet to the Test-IpBlockListProvider cmdlet:

Get-IpBlockListProvider | Test-IpBlockListProvider -IpAddress 192.168.0.1

 

Tip of the day #20:

Before you remove an object by using the Remove verb, use the WhatIf parameter to verify the results are what you expect

Tip of the day #21:

Sometimes it's useful to convert the output of a cmdlet to a string to interoperate with native cmdlets. For example, type:

Get-Mailbox | Out-String | Findstr "Administrator"

 

Tip of the day #22:

Get all Win32 WMI information, such as Perfmon counters and local computer configurations. For example, type:

Get-WMIObject Win32_PerfRawData_PerfOS_Memory

 

Tip of the day #23:

Who isn't tired of spam? You can configure real-time block list (RBL) providers with the Exchange Management Shell by running the following two commands:

Set-IPBlockListProvidersConfig -Enabled $True -ExternalMailEnabled $True

and then

Add-IPBlockListProvider -Name <Name of RBL Provider> -LookupDomain <FQDN of RBL Provider> -AnyMatch $True

 

Tip of the day #24:

Access the event log from the Exchange Management Shell. To retrieve the whole event log, type:

Get-EventLog Application | Format-List

To retrieve all Exchange-related events, type:

Get-EventLog Application | Where { $_.Source -Ilike "*Exchange*" }

 

Tip of the day #25:

One benefit of the Exchange Management Shell is that cmdlets can output objects to the console. You can then manipulate this output and organize it in interesting ways. For example, to get a quick view in tabular format, use Format-Table:

Get-Mailbox | Format-Table Name,Database,RulesQuota

 

Cheers,

Rhoderick

Rhoderick Milne [MSFT]

Leave a Reply

Your email address will not be published. Required fields are marked *