User authorizations ...
 
Notifications
Clear all

Remove user authorizations from all mailboxes

16 Posts
3 Users
0 Reactions
4,102 Views
(@helgomat)
Active Member
Joined: 3 years ago
Posts: 8
Topic starter  

Hello!

Is there a simple method to remove a user or his authorizations from all mailboxes?

We have several function mailboxes and several users have access to each of them.

Unfortunately, we don't have an overview of which user has access to which mailboxes and you can't see this in the EAC, so I would like to solve this with a Powershell command, for example.

Are there any possibilities?


   
Quote
NorbertFe
(@norbertfe)
Joined: 4 years ago
Posts: 1629
 

Yes, and Google is bound to come up with some ideas ;)


   
ReplyQuote

(@helgomat)
Active Member
Joined: 3 years ago
Posts: 8
Topic starter  
Published by: @norbertfe

Yes, and Google is bound to come up with some ideas ;)

Wow. What a helpful answer. If I had found something on Google, I wouldn't be asking here. But of course you can make forums completely superfluous if you can always google everything. It's good that there are forum members like you who can help you so selflessly and quickly.


   
ReplyQuote
NorbertFe
(@norbertfe)
Joined: 4 years ago
Posts: 1629

   
ReplyQuote

(@helgomat)
Active Member
Joined: 3 years ago
Posts: 8
Topic starter  

The problem now is that I am thrown out that only the first 1000 elements are returned. If I e.g.

Get-Mailbox ? {$_.GrantSendOnBehalfTo -match "max.mustermann"}

the message appears. I select a specific mailbox or a specific user. How can it then throw out such a message? Also a

-ResultSize unlimited

does not help. Then he works for a relatively long time and spends nothing.


   
ReplyQuote
NorbertFe
(@norbertfe)
Joined: 4 years ago
Posts: 1629
 

Perhaps it would be helpful if you wrote down what you are doing in an understandable way and didn't assume that readers would immediately know why you made mistakes.

a

get-mailbox -resultsize unlimited | ? {$_.GrantSendOnBehalfTo -match "max.mustermann"}

works for me. Of course in my case it doesn't say max.mustermann but "Max Mustermann" ;)


   
ReplyQuote

(@helgomat)
Active Member
Joined: 3 years ago
Posts: 8
Topic starter  
Published by: @norbertfe

Perhaps it would be helpful if you wrote down what you are doing in an understandable way and didn't assume that readers would immediately know why you made mistakes.

a

get-mailbox -resultsize unlimited | ? {$_.GrantSendOnBehalfTo -match "max.mustermann"}

works for me. Of course in my case it doesn't say max.mustermann but "Max Mustermann" ;)

I enter the above command. I don't know what is incomprehensible about it.

I suspect that it is due to the environment. There are 15,000 mailboxes on the server(s).


   
ReplyQuote
NorbertFe
(@norbertfe)
Joined: 4 years ago
Posts: 1629
 
Published by: @helgomat

I enter the above command. I don't know what is incomprehensible about it.

Well, just pick a mailbox where you know that someone has this right. And then try to get a result for _this one_ mailbox. Maybe max.mustermann is the wrong syntax.


   
ReplyQuote

(@helgomat)
Active Member
Joined: 3 years ago
Posts: 8
Topic starter  
Published by: @norbertfe
Published by: @helgomat

I enter the above command. I don't know what is incomprehensible about it.

Well, just pick a mailbox where you know that someone has this right. And then try to get a result for _this one_ mailbox. Maybe max.mustermann is the wrong syntax.

That's exactly what I did and it's not the wrong syntax either.


   
ReplyQuote
NorbertFe
(@norbertfe)
Joined: 4 years ago
Posts: 1629
 
Published by: @helgomat

That's exactly what I did and it's not the wrong syntax either.

And one of the mailboxes also returned a result? I would like to point out that I am not clairvoyant here. Perhaps you would like to formulate your answers in more detail about what you have done and what works or doesn't work?


   
ReplyQuote

(@helgomat)
Active Member
Joined: 3 years ago
Posts: 8
Topic starter  
Published by: @norbertfe
Published by: @helgomat

That's exactly what I did and it's not the wrong syntax either.

And one of the mailboxes also returned a result? I would like to point out that I am not clairvoyant here. Perhaps you would like to formulate your answers in more detail about what you have done and what works or doesn't work?

If I use a normal query such as

get-mailbox -identity "Max.Musterman"

I also get data. As soon as I want to query authorizations, the message "WARNING: Only the first 100 elements are returned by default..." appears.

Or also with

Get-Mailbox | Get-MailboxPermission -User Max.Mustermann
This post was modified 3 years ago by Helgomat

   
ReplyQuote
NorbertFe
(@norbertfe)
Joined: 4 years ago
Posts: 1629
 
Published by: @helgomat

As soon as I want to query authorizations, the message "WARNING: By default, only the first 100 elements are returned..." appears.

Or also with

Which is logical, because the first one only returns one result by definition.

I can assure you that in an environment with approx. 10,000 mailboxes, the following command will return results. Of course, you won't know who has the permissions, but at least you will know which mailboxes you need to check.

get-mailbox -resultsize unlimited | ? {$_.GrantSendonBehalfTo -ne $null}

   
ReplyQuote

NorbertFe
(@norbertfe)
Joined: 4 years ago
Posts: 1629

   
ReplyQuote
(@helgomat)
Active Member
Joined: 3 years ago
Posts: 8
Topic starter  

No matter which user I choose, I always get the "1000" warning.

With

get-mailbox -resultsize unlimited | ? {$_.GrantSendonBehalfTo -ne $null}

I get a result.

But the mailboxes that belong to my OU cannot be queried either. The warning message also appears here


   
ReplyQuote

NorbertFe
(@norbertfe)
Joined: 4 years ago
Posts: 1629
 

I get a result.

I see. And where don't you get one? Honestly, you read here and think to yourself... Can't "he" even write in detail? If that's too much to ask...


   
ReplyQuote
(@hellhunter)
Active Member
Joined: 3 years ago
Posts: 4
 

Try the following commands:

To find out which mailboxes the user "max.mustermann" has "Send as" access rights to:

Get-Mailbox -ResultSize Unlimited | Get-RecipientPermission -Trustee max.mustermann | select identity

And for the full access rights:

Get-Mailbox -ResultSize unlimited | Get-MailboxPermission -User max.mustermann | select identity

You should only get the "1000" message if you omit the "-ResultSize Unlimited".

You can also restrict the search by using the "-RecipientTypeDetails" parameter.

For example, to output only "user mailboxes" to which the user "max.mustermann" has full access rights, the command would be as follows:

Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize unlimited | Get-MailboxPermission -User max.mustermann | select identity


   
ReplyQuote

Share: