$user = "ekaterina.polishchuk@remind.ru"
$rooms = @(
"ConfRoom_1@remind.ru",
"ConfRoom_2@remind.ru",
"ConfRoom_3@remind.ru",
"ConfRoom_4@remind.ru",
"ConfRoom_5@remind.ru",
"ConfRoom_6@remind.ru"
)
foreach ($room in $rooms) {
$calendarPath = "$room`:\Calendar"
$perm = Get-MailboxFolderPermission -Identity $calendarPath -User $user -ErrorAction SilentlyContinue
if ($perm) {
Set-MailboxFolderPermission -Identity $calendarPath -User $user -AccessRights Editor
Write-Host "Updated: $user -> Editor on $calendarPath"
}
else {
Add-MailboxFolderPermission -Identity $calendarPath -User $user -AccessRights Editor
Write-Host "Added: $user -> Editor on $calendarPath"
}
}