コード
<#
.SYNOPSIS
メールボックス情報取得
.PARAMETER Id
Identityパラメータ
.EXAMPLE
GetMailbox TestUser*
# >
function GetMailbox([Parameter(Mandatory)][string]$Id)
{
Write-Host "開始..." -ForegroundColor Cyan
Get-Mailbox -Identity $Id | ForEach-Object {
$cas = Get-CASMailbox -Identity $_.SamAccountName
$mfs = Get-MailboxFolderStatistics -Identity $_.SamAccountName |
Where-Object {$_.FolderType -eq "Calendar"} | Select-Object Name
[string]$key = "{0}:\{1}" -f $_.SamAccountName, $mfs.Name
$mfp = Get-MailboxFolderPermission -Identity $key -User Default
Write-Output ("sAMAccountName`t" + $_.sAMAccountName)
Write-Output ("userPrincipalName`t" + $_.userPrincipalName)
Write-Output ("表示名`t" + $_.displayname)
Write-Output ("エイリアス`t" + $_.alias)
Write-Output ("メールボックス格納先DB`t" + $_.database)
Write-Output ("メールアドレス`t" + $_.emailAddresses)
Write-Output ("メールボックスの警告を表示する使用量`t" + $_.issueWarningQuota)
Write-Output ("メールボックスの送信を禁止する使用量`t" + $_.prohibitSendQuota)
Write-Output ("メールボックスの送受信を禁止する使用量`t" + $_.prohibitSendReceiveQuota)
Write-Output ("受信できるメッセージの最大サイズ`t" + $_.MaxReceiveSize)
Write-Output ("送信できるメッセージの最大サイズ`t" + $_.MaxSendSize)
Write-Output ("アドレス一覧に表示しない`t" + $_.HiddenFromAddressListsEnabled)
Write-Output ("Exchange ActiveSyncを有効にする`t" + $cas.ActiveSyncEnabled)
Write-Output ("Outlook Web App:有効`t" + $cas.OWAEnabled)
Write-Output ("IMAP:有効`t" + $cas.ImapEnabled)
Write-Output ("POP3:有効`t" + $cas.PopEnabled)
Write-Output ("ブロックされた送信者リストに追加できる送信者の最大数`t" + $_.MaxBlockedSenders)
Write-Output ("メールを次の受信者に転送`t" + $_.ForwardingAddress)
Write-Output ("転送先アドレスとメールボックスの両方にメッセージを配信`t" + $_.DeliverToMailboxAndForward)
Write-Output ("代理人として送信`t" + $_.GrantSendOnBehalfTo)
Write-Output ("予定表アクセス権`t" + $mfp.AccessRights)
Write-Output ("カスタム属性1`t" + $_.CustomAttribute1)
Write-Output ("カスタム属性2`t" + $_.CustomAttribute2)
Write-Output ("カスタム属性3`t" + $_.CustomAttribute3)
Write-Output ("カスタム属性4`t" + $_.CustomAttribute4)
Write-Output ("カスタム属性5`t" + $_.CustomAttribute5)
Write-Output ("カスタム属性6`t" + $_.CustomAttribute6)
Write-Output ("カスタム属性7`t" + $_.CustomAttribute7)
Write-Output ("カスタム属性8`t" + $_.CustomAttribute8)
Write-Output ("カスタム属性9`t" + $_.CustomAttribute9)
Write-Output ("カスタム属性10`t" + $_.CustomAttribute10)
Write-Output ("カスタム属性11`t" + $_.CustomAttribute11)
Write-Output ("カスタム属性12`t" + $_.CustomAttribute12)
Write-Output ("カスタム属性13`t" + $_.CustomAttribute13)
Write-Output ("カスタム属性14`t" + $_.CustomAttribute14)
Write-Output ("カスタム属性15`t" + $_.CustomAttribute15)
Write-Output "----------"
}
Write-Host "終了" -ForegroundColor Cyan
}
実行イメージ
[PS] C:\Windows\system32> GetMailbox User*
開始...
sAMAccountName User01
userPrincipalName xxxxxxx@xxxxx.xxxx
表示名 xxxxxxxxxxxxxx
エイリアス xxxxxxxxxxxx
メールボックス格納先DB xxxxxxxx
メールアドレス SMTP:xxxxxxx@xxxx.xxx.xx smtp:xxxxxxxxxxx@xxxx.xx
メールボックスの警告を表示する使用量 xxx MB (xxx,xxx,xxx bytes)
メールボックスの送信を禁止する使用量 xxx MB (xxx,xxx,xxx bytes)
メールボックスの送受信を禁止する使用量 xxx MB (xxx,xxx,xxx bytes)
受信できるメッセージの最大サイズ Unlimited
送信できるメッセージの最大サイズ Unlimited
アドレス一覧に表示しない False
Exchange ActiveSyncを有効にする True
Outlook Web App:有効 True
IMAP:有効 True
POP3:有効 True
ブロックされた送信者リストに追加できる送信者の最大数 xxx
メールを次の受信者に転送 xxxxxxxxxxxxxxxxxxxxx
転送先アドレスとメールボックスの両方にメッセージを配信 True
代理人として送信 xxxxxx/xxxx/xxxxxxxxxx
予定表アクセス権 AvailabilityOnly
カスタム属性1 xxxxx
カスタム属性2 xxxx
カスタム属性3 xxxxxxx
カスタム属性4 xx
カスタム属性5 xxxxxx
カスタム属性6
カスタム属性7
カスタム属性8
カスタム属性9
カスタム属性10
カスタム属性11
カスタム属性12
カスタム属性13
カスタム属性14
カスタム属性15
----------
sAMAccountName User02
userPrincipalName xxxxxxx@xxxxx.xxxx
表示名 xxxxxxxxxxxxxx
エイリアス xxxxxxxxxxxx
メールボックス格納先DB xxxxxxxx
メールアドレス SMTP:xxxxxxx@xxxx.xxx.xx smtp:xxxxxxxxxxx@xxxx.xx
メールボックスの警告を表示する使用量 Unlimited
メールボックスの送信を禁止する使用量 Unlimited
:
:
:
動作確認した環境
- Exchange Management Shell (Exchange 2013), Windows Server 2012