question

GlennMaxwell-2309 avatar image
0 Votes"
GlennMaxwell-2309 asked itchsun-msft edited

shared mailbox permissons

Hi Experts i have a shared mailbox and i want to give full access and send as permissions to 50 users, i want to use the below syntax please correct me.

For sendas permissions how can i suppress the below confirmation message
Confirm
Are you sure you want to perform this action?
Adding recipient permission 'SendAs' for user or group 'user1@contoso.com' on recipient 'sharedmailbox@contoso.com'.

Below is my csv file
Users
user1@contoso.com
user2@contoso.com


$UserList = import-csv C:\temp\list.csv
ForEach ($User in $UserList)
{
Add-MailboxPermission -Identity sharedmailbox@contoso.com -User $user.Users -AccessRights FullAccess -InheritanceType All -AutoMapping $True
Add-RecipientPermission sharedmailbox@contoso.com -AccessRights SendAs -Trustee $user.Users
}

in case if i need to remove the access is the below syntax correct and how do i suppress the confirmation message.

$UserList = import-csv C:\temp\list.csv
ForEach ($User in $UserList)
{
Remove-MailboxPermission -Identity sharedmailbox@contoso.com -User $user.Users -AccessRights FullAccess
Remove-RecipientPermission sharedmailbox@contoso.com -AccessRights SendAs -Trustee $user.Users
}

office-exchange-server-administrationoffice-exchange-online-itprooffice-exchange-server-itpro
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @GlennMaxwell-2309
According to your description, this question seems to be related to Exchange, so we would move the irrelevant tags.

0 Votes 0 ·
michev avatar image
0 Votes"
michev answered

Use the -Confirm switch: https://docs.microsoft.com/en-us/exchange/whatif-confirm-and-validateonly-switches-exchange-2013-help#confirm-switch

 $UserList = import-csv C:\temp\list.csv
 ForEach ($User in $UserList)
 {
 Remove-MailboxPermission -Identity sharedmailbox@contoso.com -User $user.Users -AccessRights FullAccess -Confirm:$false
 Remove-RecipientPermission sharedmailbox@contoso.com -AccessRights SendAs -Trustee $user.Users -Confirm:$false
 }
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

GlennMaxwell-2309 avatar image
0 Votes"
GlennMaxwell-2309 answered michev commented

so for adding users as well i can use the syntax -Confirm:$false for Send As?

$UserList = import-csv C:\temp\list.csv
ForEach ($User in $UserList)
{
Add-MailboxPermission -Identity sharedmailbox@contoso.com -User $user.Users -AccessRights FullAccess -InheritanceType All -AutoMapping $True
Add-RecipientPermission sharedmailbox@contoso.com -AccessRights SendAs -Trustee $user.Users -Confirm:$false
}

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

You can use it for any cmdlet that requires confirmation.

0 Votes 0 ·