fuzzyfreak
asked on
How do I add multiple users to a Powershell command so that they have access to a calendar on a mailbox?
I have the command I need to add one user to my calendar -
But what if, in addition to Suzan, I want Patrick, Adrian and Paul?
thanks
Add-MailboxFolderPermission John:\calendar -AccessRight PublishingEditor -User Suzan
But what if, in addition to Suzan, I want Patrick, Adrian and Paul?
thanks
ASKER
Justin, can you please put the code tags around this because the spaces are confusing me - I tried the code without the spaces and it doesn't like various parts such as 'foreach' and 'in' and '(' and ')'
thanks
thanks
[array]$Users = @("Suzan","Patrick","Adrian","Paul")
foreach ($User in $Users)
{
Add-MailboxFolderPermission John:\calendar -AccessRight PublishingEditor -User $User
}
ASKER
Thanks I'll give this a go once back in the office.
ASKER
Justin, thank you very much, this worked perfectly!
I now wish to apply this to multiple mailboxes, I tried adjusting that script to simply add the additional one underneath but this did not work, see below for example -
I now wish to apply this to multiple mailboxes, I tried adjusting that script to simply add the additional one underneath but this did not work, see below for example -
[array]$Users = @("Suzan","Patrick","Adrian","Paul")
foreach ($User in $Users)
{ Add-MailboxFolderPermission John:\calendar -AccessRight PublishingEditor -User $User }
{ Add-MailboxFolderPermission alan:\calendar -AccessRight PublishingEditor -User $User }
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is perfect, worked like a dream.
thank you very much!
thank you very much!
ASKER
Excellent solution!
foreach ($User in $Users)
{
Add-MailboxFolderPermissio
}