In this article, we review that basic PowerShell command syntax that we use for display information about the E-mail addresses of Exchange Online recipients.
In addition, we review the PowerShell command syntax that we use in case that we need to export the PowerShell command output the various type files such as – TXT, CSV, HTML and XML.
as – Get-Recipient that relate to most of the existing Exchange Online recipient’s types.
Most of the time, we want to selective “tell” PowerShell, what is the specific object (recipient) properties that we want to view.
Recipient properties that “store” E-mail address information such as EmailAddresses or, PrimarySmtpAddress.
At the same time, PowerShell enables us to create a “custom properties” (number 3) that include the name that we define for the specific property and a “calculated output” such as – a result of a query, some calculations, and so on.
Displayed on the PowerShell console.
Exported to various file types such as – TXT,CSV,XML and HTML.
In the following diagram, we can see the structure of the PowerShell command that we use for displaying information about “E-mail addresses” and optionally, export the information to a file.
The “main store” that serve as a “logical container” for all the types of E-mail addresses in Exchange Online environments is – a field named – “EmailAddresses”.
Note – In Office 365 and Exchange Online environment there are additional “email property” fields. For example, Exchange Online uses the following properties – WindowsEmailAddress and PrimarySmtpAddress for storing information about the primary E-mail address.
Smtp E-mail address (primary E-mail address and Proxy E-mail address.
Non-smtp E-mail address” such as – SIP address, that is used as user identity when using the Skype for business services.
The “default” PowerShell command syntax that we use for – display information about a recipient E-mail address is quite simple.
The specific type of recipient such as “mailbox recipient”.
The specific properties that we want to display such as – DisplayName, PrimarySmtpAddress, EmailAddresses.
In the following screenshot, we can see the result (the “EmailAddresses” property content).
existing E-mail address, and “other address” that the recipient has such x500 E-mail address and SIP address.
recipient’s E-mail addresses, working with the PowerShell console, is not so comfortable because of built-in limitations.
For example, in case that a specific recipient has multiple E-mail addresses, the PowerShell console, is not able by default to display all the E-mail addresses.
Instead, the PowerShell console displays a limit number of E-mail addresses and use the three dots characters (…).
The purpose of the three dots characters (…) is to “tell” us, that there are additional E-mail addresses that cannot be displayed.
One of the most common administrative tasks that relate to Exchange recipients is the need to view, and export information about the recipient E-mail address.
In many scenarios, we will need to “save” the information about the recipient E-mail address for later use by exporting the information to a file.
In the former articles, we review the PowerShell command with the “Set prefix” such as Set-Mailbox that was used to update the Exchange recipient email address.
To be able to get information about specific property of the Exchange Online recipient, such as the recipient E-mail address, we use the PowerShell command with the “Get prefix” such as Get-Mailbox.
The PowerShell command Get-Mailbox, display the output on the PowerShell console, and in case that we need to export the information, we add additional “part” to the PowerShell command, with instructions about the file type that we want to use.
When we want to export the “command output” to a File, we need to “tell” PowerShell what is the required file format that we want to use.
A mandatory requirement when export command output to a file is the “File name.
The “path” parameter is not a mandatory parameter. Most of the times, when we export information to a file, we will also provide the “path” information.
In case that we don’t provide a specific path, PowerShell exports the file to the folder from which we run the PowerShell command.
In other words, by default, the PowerShell command will not “create for us” a specific folder that was specified in the “path” parameter.
The following section, include an example of PowerShell command syntax that we use for exporting information about the E-mail addresses of Exchange Online mailbox recipients using the four file formats.
In the following section, we can see an example of the “export syntax” for four file formats – TXT,CSV,XML and HTML.
Export PowerShell command output to a Text file.
Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,PrimarySmtpAddress,EmailAddresses,EmailAddresses | Out-File C:\Temp\"Exchange Online recipients.TXT"
Export PowerShell command output to a CSV file.
Export PowerShell command output to an HTML file.
Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,PrimarySmtpAddress,EmailAddresses,EmailAddresses | ConvertTo-Html | Out-File C:\Temp\"Exchange Online recipients.HTML"
Export PowerShell command output to a XML file.
Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,PrimarySmtpAddress,EmailAddresses,EmailAddresses | Export-Clixml C:\Temp\"Exchange Online recipients.XML"
In this article, we review that basic PowerShell command syntax that we use for display information about the E-mail addresses of Exchange Online recipients.In addition, we review the PowerShell command syntax that we use in case that we need to export the PowerShell command output the various type files such as – TXT, CSV, HTML and XML.