Get-MailboxProperties
Exchange Online: Gets mailbox properties for a specified mailbox
#Requires -Version 5.1
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$MailboxId,
[ValidateSet('*','DisplayName','FirstName','LastName','Office','Phone','WindowsEmailAddress','AccountDisabled','DistinguishedName','Alias','Guid','ResetPasswordOnNextLogon','UserPrincipalName')]
[string[]]$Properties = @('DisplayName','FirstName','LastName','Office','Phone','WindowsEmailAddress','AccountDisabled','DistinguishedName','Alias','Guid','ResetPasswordOnNextLogon','UserPrincipalName')
)
Process {
try {
$result = Get-Mailbox -Identity $MailboxId -ErrorAction Stop | Select-Object $Properties
if ($null -eq $result) {
throw "Mailbox $($MailboxId) not found"
}
$result | ForEach-Object {
$_ | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force
}
}
catch { throw }
}Alias, Display name, Distinguished name, SamAccountName, Guid or user principal name of the mailbox
List of properties to expand. Use * for all properties