[英]Nested ForEach statements - Exchange Powershell - bulk remove mailbox calendar permissions -
[英]Setting Exchange 2010 Calendar permissions with powershell script
我找到了以下腳本,並對其進行了少許修改,以為用戶(而非資源郵箱)設置默認的日歷權限。 看起來它可以正常運行,但是您可以看看它是否有明顯的問題嗎?
$mailboxes = Get-Mailbox | where {$_.ResourceType -ne "Room"}
$mailboxes | foreach {
$user=$_.Alias
$path=$user+”:\Calendar”
Set-MailboxFolderPermission –Identity $path -User Default -AccessRights Reviewer
}
在我看來還可以(未經測試)。 我將添加ResultSize參數以繞過1000個對象限制。 看起來您可以將其縮短一點。 在所有郵箱對象上運行之前,請對測試用戶嘗試此操作。
$mailboxes = Get-Mailbox -ResultSize Unlimited | Where-Object {$_.ResourceType -ne 'Room'}
$mailboxes | Foreach-Object { Set-MailboxFolderPermission –Identity ($_":\Calendar") -User Default -Accessrights Reviewer }
$mailboxes = Get-Mailbox -ResultSize Unlimited | Where-Object {$_.ResourceType -ne 'Room'}
$mailboxes | Foreach-Object { Set-MailboxFolderPermission –Identity ($_.Alias+":\Calendar") -User Default -Accessrights Reviewer }
$ mailboxes = Get-Mailbox -ResultSize無限| Where-Object {$ .ResourceType -ne'Room'} $ mailboxes | Foreach對象{Set-MailboxFolderPermission $ “:\\ Calendar”-用戶默認-訪問權限查看者}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.