Solved

List users in Shared Account (Exchange 2013)

Posted on 2016-09-26
15
52 Views
Last Modified: 2016-10-07
I have been looking for a way, in the exchange command shell, to list users in a shared group. Having it convert to a csv is a bonus. Getting directions on doing one shared group at a time and all shared groups at one time would be great. I know how to list just shared groups, but not the members within it. That is what I need.  

I found a forum where you can write up a PS Script but I am not that savvy with power shell. I am a beginner.
0
Comment
Question by:Erik Townsend
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
15 Comments
 
LVL 40

Assisted Solution

by:Subsun
Subsun earned 250 total points
ID: 41816354
I am not that clear about the question...

What is shared group?
If it's a distribution group then you can use Get-DistributionGroupMember, Following is the example..
Get-DistributionGroup GroupA | Get-DistributionGroupMember -ResultSize Unlimited | Select DisplayName,PrimarySmtpAddress | Export-CSV C:\Group.csv -nti

Open in new window


If it's a shared mailbox and you need a list of users who has full access to it then use Get-MailboxPermission ..
Get-MailboxPermission MailboxName |?{$_.AccessRights -like "*Fullaccess*"} | Select User,{$_.AccessRights}  | Export-CSV C:\MailboxName.csv -nti

Open in new window

0
 

Author Comment

by:Erik Townsend
ID: 41816405
I can use this to get a list of just the shared groups: Get-Recipient -Resultsize unlimited | where {$_.RecipientTypeDetails -eq "SharedMailbox"} | ft Name,Manager >C:\temp\shared.csv

That works great. What I need is a csv with a list of who is in each shared group.

example:
Accounting
Erik Townsend
Jack Bean

Like that. I am not sure how else to explain it. I hope that was helpful.
0
 

Author Comment

by:Erik Townsend
ID: 41816429
Yes. Thank you for being patient. That is what I mean.

Get-Mailbox -ResultSize Unlimited | Where-Object {$_.RecipientTypeDetails -eq "SharedMailbox"} | Get-MailboxPermission | Where-Object { $_.AccessRights -eq "FullAccess" }

The above seems to work, but I can not get it to convert to a .csv. Plus on the powershell, the name for all the shared mailboxes just says,"NT AUTHORUTY\SYSTEM" instead of the name like accountspayable. I believe it is listing them in order so I can manually type in the names if I have too.
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 40

Expert Comment

by:Subsun
ID: 41816431
That works great. What I need is a csv with a list of who is in each shared group
I understand by shared group you mean a shared mailbox.

So 'with a list of who is in each shared group' You mean, you need a list of users who has full access to the shared mailbox?
If yes, try following code and see if you get the results as expected.

Get-Recipient -RecipientTypeDetails SharedMailbox | Select Name,Manager,@{N="Users";E={(Get-MailboxPermission $_.Name |?{$_.AccessRights -like "*Fullaccess*"} | ?{$_.User -notmatch "SYSTEM|SELF|^S-1-5"}|Select -exp User) -join ","}} | Export-csv C:\report.csv -nti

Open in new window

0
 

Author Comment

by:Erik Townsend
ID: 41816445
I used this to list the shared mailboxes to a csv:
Get-Recipient -Resultsize unlimited | where {$_.RecipientTypeDetails -eq "SharedMailbox"} | ft Name,Manager >C:\temp\shared.csv

This worked as well.
0
 

Author Comment

by:Erik Townsend
ID: 41816453
I tried using: Get-Mailbox -ResultSize Unlimited | Where-Object {$_.RecipientTypeDetails -eq "SharedMailbox"} | Get-MailboxPermission | Where-Object { $_.AccessRights -eq "FullAccess" } | ft Name,Manager >C:\temp\shared.csv

I thought the columns would be mislabeled but it would still show the results I am looking for. Instead it did create a csv but only had the headers for two columns but none of the other information. Ideas?
0
 
LVL 15

Accepted Solution

by:
Todd Nelson earned 250 total points
ID: 41816461
And what happens when you modify the command slightly?

Get-Mailbox -ResultSize Unlimited | Where-Object {$_.RecipientTypeDetails -eq "SharedMailbox"} | Get-MailboxPermission | Where-Object { $_.AccessRights -eq "FullAccess" } | Export-Csv C:\temp\shared.csv -notype

Open in new window


FYI ... Piping the console output really doesn't create a useful CSV file.
1
 
LVL 40

Expert Comment

by:Subsun
ID: 41816469
Did you try the command which I posted? Is it not giving the list of users who has full permission including the name of share account and the Manager?
0
 
LVL 40

Expert Comment

by:Subsun
ID: 41816480
To get the display names of users instead of ,"Domain\user" format, use the following code..
$Mailbox = Get-Recipient -RecipientTypeDetails SharedMailbox
$(Foreach ($Mbx in $Mailbox){
Write-Host "Working on $($Mbx.Name)"
$Users = Get-MailboxPermission $Mbx.Name |?{$_.AccessRights -like "*Fullaccess*"} | ?{$_.User -notmatch "SYSTEM|SELF|^S-1-5"}
New-Object PSobject -Property @{
 Name = $Mbx.Name
 Manager = $Mbx.Manager
 Users = ($Users | %{Try{$User = $_.User;Get-Recipient $User -ea STOP | Select -exp DisplayName}Catch{($User -split "\\")[1]}}) -join ","
}
})| Export-csv C:\Report.csv -nti

Open in new window

Let me know if you get any issue with script..
0
 

Author Comment

by:Erik Townsend
ID: 41816542
Subsun and Todd, Thank you for all your insight. I have what I need.
0
 

Author Comment

by:Erik Townsend
ID: 41816546
Thanks a lot. I can take that spread sheet and slightly tweak it for use.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 41816552
FYI, The answer you selected will not show you, for which shared mailbox the permissions belongs to..

My script will show the result like following screenshot (If you open the result csv file in excel), so you know the permission related to each mailbox. Get result of all shared mailbox in once result file..
Untitled.jpg
1
 

Author Comment

by:Erik Townsend
ID: 41816659
Sabsun, I will play around with yours because now they want both Full Access vs Send As lists. But I am going to work on that sometime Wednesday.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 41816705
I had answered similar question few days back with Send-as and full mailbox permission, check it out..

https://www.experts-exchange.com/questions/28968408/Powershell-to-get-shared-mailboxes-permissions.html

BTW, I can see you are new to EE, if you don't know how to accept multiple responses, this EE support article explains it: :-)
http://support.experts-exchange.com/customer/portal/articles/608596-how-do-i-accept-multiple-comments-as-my-solution-?b_id=44
1

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
A brief introduction to what I consider to be the best editor for PowerShell.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question