Help Bulk Permission changes O365 Conferance Rooms

Welcome Forums General PowerShell Q&A Help Bulk Permission changes O365 Conferance Rooms

This topic contains 1 reply, has 2 voices, and was last updated by

 
Participant
4 years, 8 months ago.

  • Author
    Posts
  • #16311

    Participant
    Points: 0
    Rank: Member

    I am very new to PowerShell and trying to set permissions on our Conference rooms that have just been migrated from 2010 Exchange to O365.
    I what to run the powershell command.

    Set-MailboxFolderPermission -AccessRights LimitedDetails -Identity Room:\calendar -User default

    on all of our Conference rooms but i am not sure how to pass -identity to powershell to edit all Conferance rooms i have tried

    Set-MailboxFolderPermission -AccessRights LimitedDetails -Identity (Get-Mailbox | where {$_.resourcetype -eq"room"} | Select -Expandproperty primarysmtpaddress):\calendar -User default

    i know that -identity is looking for MailboxFolderUserIdParameter and the cmd i am passing is giving it a string value just now sure where to go.

    Thanks for any help.

  • #16312

    Participant
    Points: 0
    Rank: Member

    I don't recommend using a one-liner on scripts of this nature, as it's easier to troubleshoot and understand what's going on with variables. I added a -WhatIf for safety; run the first time to verify it's what you'd want to do, then run just the foreach loop the second time without the -whatif to change permissions.

    #Get a list of rooms
    $list = Get-Mailbox -ResultSize Unlimited | where {$_.resourcetype -eq "room"}; $list
     
    #For each room get the calendar permissions, isolate the default user, and verify the permissions, changing if not what is desired.
     
    foreach($mbx in $list){
    	$CalendarPermission = Get-MailboxFolderPermission -Identity "$($mbx.UserPrincipalName):\calendar"
    	$default = $CalendarPermission | where{$_.User.DisplayName -eq "Default"}
    	if($default){
    		if($default.AccessRights -ne "LimitedDetails"){Set-MailboxFolderPermission -Identity "$($mbx.UserPrincipalName):\calendar" -User Default -AccessRights "LimitedDetails" -Whatif}
    		Clear-Variable default
    	}else{"No default user found for $($mbx.UserPrincipalName)"}
    }
    

    Edit: Added an if($default) on the off chance someone removed the default user
    Edit: Added -ResultSize Unlimited in case you have over 1000 mailboxes

The topic ‘Help Bulk Permission changes O365 Conferance Rooms’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort