问题描述
在我的脚本中,我需要知道一个帐户是Mail-User
,Mail-Contact
还是许可的用户帐户.
In my script I need to know whether an account is a Mail-User
, Mail-Contact
or licensed user account.
目前,我必须事先知道这一点并将其自己提供给脚本.
Presently I have to know this before-hand and supply it to the script myself.
有没有比这更好的方法了?这仅在许可用户和邮件联系人或邮件用户之间进行计算.
Is there a better way than this? This only figures between a licensed user and a Mail-Contact-or-Mail-User.
#test for existing account
function GetAccountType($whatusername){
$isType = [bool](get-mailbox -identity $whatusername -ErrorAction SilentlyContinue)
if($isType){
$thisType = "Licensed"
}else{
$isType = [bool](get-mailuser -identity $whatusername -ErrorAction SilentlyContinue)
if($isType){
$thisType = "Mail-Contact"
}
}
return $thisType
}
推荐答案
RecipientTypeDetails 指定返回的收件人的类型.
The RecipientTypeDetails specifies the type of recipients returned.
您可以使用获取收件人从以下值中进行选择:
You can select from the following values with Get-Recipient:
- ArbitrationMailbox
- ConferenceRoomMailbox
- 联系
- DiscoveryMailbox
- DynamicDistributionGroup
- EquipmentMailbox
- 外部管理的联系人
- ExternalManagedDistributionGroup
- LegacyMailbox
- LinkedMailbox
- MailboxPlan
- MailContact
- MailForestContact
- MailNonUniversalGroup
- MailUniversalDistributionGroup
- MailUniversalSecurityGroup
- MailUser
- PublicFolder
- 角色组
- RoomList
- RoomMailbox
- SharedMailbox
- SystemAttendantMailbox
- SystemMailbox
- 用户
- UserMailbox
- ArbitrationMailbox
- ConferenceRoomMailbox
- Contact
- DiscoveryMailbox
- DynamicDistributionGroup
- EquipmentMailbox
- ExternalManagedContact
- ExternalManagedDistributionGroup
- LegacyMailbox
- LinkedMailbox
- MailboxPlan
- MailContact
- MailForestContact
- MailNonUniversalGroup
- MailUniversalDistributionGroup
- MailUniversalSecurityGroup
- MailUser
- PublicFolder
- RoleGroup
- RoomList
- RoomMailbox
- SharedMailbox
- SystemAttendantMailbox
- SystemMailbox
- User
- UserMailbox
根据您的情况,我了解到您需要 UserMailbox , User , MailUser , MailContact
What I am understanding from your case is that you need UserMailbox, User , MailUser , MailContact
我现在没有交流设置.但是您可以用这些值来抵消.它属于 Microsoft.Exchange.Data.Directory.Recipient.RecipientTypeDetails []
I don't have an exchange setup right now. BUt you can set off with these value.It falls under Microsoft.Exchange.Data.Directory.Recipient.RecipientTypeDetails[]
这篇关于如何确定账户类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!