我正试图找到一种方法将用户的邮箱权限复制到另一个用户,我可以在PS中输出我需要的数据,只是找不到一种方法将这些权限应用到新用户。
我不擅长PS,所以请原谅我:)
Get-Mailbox -RecipientTypeDetails UserMailBox,SharedMailbox | Get-MailboxPermission -User
,然后输出用户权限,但我希望能够在相同的脚本中添加这些权限给我的新用户。
希望对您有所帮助:
$FromUser = Read-Host "Enter the email address of the user you want to copy mailbox permissions from"
$ToUser = Read-Host "Enter the email address of the user you want to set mailbox permissions for"
$Perm = Get-Mailbox | Get-MailboxPermission -User $FromUser
$Perm | ForEach-Object { $_
Add-MailboxPermission -Identity $_.Identity -AccessRights FullAccess -InheritanceType All -AutoMapping:$true -User $ToUser
Add-RecipientPermission -Identity $_.Identity -AccessRights SendAs -Confirm:$false -Trustee $oTUser
}
这将自动查找从User1到User2的权限。您可以根据微软允许的命令将参数更改为您想要的任何内容。
https://learn.microsoft.com/en-us/powershell/module/exchange/add-mailboxpermission?view=exchange-ps
https://learn.microsoft.com/en-us/powershell/module/exchange/add-recipientpermission?view=exchange-ps