Add / Remove user in BookInPolicy / ResourceDelegate - Exchange 2013 powershell
When we create a function of ResourceDelegate, below will
be the effect:
#user gets added to calendar folder with access
permissions as {Editor}
#user gets added to ResourceDelegates and not in
BookInPolicy.
To add Calendar Resource Delegate we can use below
function which creates a cmdlet ‘Add-CalendarResourceDelegate’
in powershell:
function
Add-CalendarResourceDelegate {
Param($RoomName
, $newDelegate
)
$resourceDelegates = (Get-CalendarProcessing -Identity $RoomName).ResourceDelegates
$resourceDelegates += $newDelegate
Set-CalendarProcessing -Identity $RoomName -ResourceDelegates $resourceDelegates
}
Add-CalendarResourceDelegate -Identity $Roomname "MeetingRoom@Test.com"
-newDelegate UserID9
To Remove All Users from ResourceDelegate:
Set-CalendarProcessing -Identity "MeetingRoom@Test.com"
-ResourceDelegates $null
===========================================================
When we use function of Bookinpolicy below will be the
effect:
#user gets added to bookinpolicy and current users will
be retained.#user gets added to calendar folder with access permissions as {LimitedDetails}
To add user in Calendar BookIn Policy we can use below
function which creates a ‘Add-CalendarBookInPolicy’ cmdlet in powershell:
function
Add-CalendarBookInPolicy {
Param($roomName
, $newUser
)
$bookInPolicy = (Get-CalendarProcessing -Identity $roomName).BookInPolicy
$bookInPolicy += $newUser
Set-CalendarProcessing -Identity $roomName -BookInPolicy $bookInPolicy
}
CMD syntax:
Add-CalendarBookInPolicy -Identity $Roomname "MeetingRoom@Test.com"
-newUser UserID
To Remove All Users from BookinPolicy:
Set-CalendarProcessing -Identity "MeetingRoom@Test.com"
-BookInPolicy $NulTo Remove Single User from ResourceDelegate:
function Remove-CalendarResourceDelegate {
Param(
$roomName
,
$delegateToRemove
)
$resourceDelegates
= (Get-CalendarProcessing -Identity $roomName).ResourceDelegates
$delegateToRemoveIdentity
= (Get-Mailbox $delegateToRemove).Identity
$resourceDelegates.Remove($delegateToRemoveIdentity)
Set-CalendarProcessing
-Identity $roomName -ResourceDelegates $resourceDelegates
}
#CMD syntax:
Remove-CalendarResourceDelegate -roomName
“MeetingRooms@Test.com” -delegateToRemove User1
Note: Custom functions/cmdlet are only available
until the current session is active. Next time when you start EMS, again we
have to create function/cmdlet. To make it persistent need to write some other
codes.
Hey Great Work, but will it work for Office 365 as well.
ReplyDeleteI have a private room mailbox on which set of people has the access, but when i run Set-calendarprocessing all the people added in bookinpolicy will get removed so instead I have to add them in Book in policy.. but the command is not working for Office 365, Can you please try and let me know the correct command
Hi Aamir, Sure this will work on O365.
DeleteAlso how can i remove one user from 100's of users added in Bookin policy.. Have you encountered any issues..
DeleteI have updated post with removal of single user from ResourceDelegate. Similarly you may have to change the script for BookInPolicy.
Delete