Jerry Seinfield
asked on
script for exchange
Hi Experts,
I need from your expertise in PowerShell
There are two users I want to permanently remove from all mailboxes as having "full" access.
Can we PowerShell something that will remove Them from all mailboxes if they are there? I need to export the results of the command
Exchange version 2013 SP1
Thanks in advance
I need from your expertise in PowerShell
There are two users I want to permanently remove from all mailboxes as having "full" access.
Can we PowerShell something that will remove Them from all mailboxes if they are there? I need to export the results of the command
Exchange version 2013 SP1
Thanks in advance
Get-Mailbox | Remove-MailboxPermission -User domain\username -AccessRights FullAccess -InheritanceType All
You can do this via a script. Add your 2 users to a text file, one on each line.
Will.
$RMUsers = Get-Content "c:\users.txt"
ForEach ($User in $RMUsers) {
Get-Mailbox -ResultSize "unlimited" | Remove-MailboxPermissions -User $User -AccessRights -InheritanceType All
}
Will.
ASKER
can you please elaborate on the text file, attach an example please
It is same command, what I gave, Will gave you option to give user in an input file. For whom you want to remove the permission.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ya, you are right. However there are only 2 users.
With only two users, I think setting up the txt file is a little overkill but a great option if you're talking about more users. With only two users, you can simply re-run Amit's command for the second user. You should , however, add in the ResultSize because we don't know how many total mailboxes we're trying to remove permissions from.
Where the <user email address> is the user who has the FullAccess permissions to the mailboxes that needs to be removed. You can do domain\user as well, it works interchangeably IIRC.
Get-Mailbox -ResultSize Unlimited | Remove-MailboxPermission -User <user email address> -AccessRights FullAccess -InheritanceType All
Where the <user email address> is the user who has the FullAccess permissions to the mailboxes that needs to be removed. You can do domain\user as well, it works interchangeably IIRC.