troubleshooting Question

Get names of users from Get-MailboxPermission

Avatar of garryshape
garryshape asked on
ExchangePowershell
3 Comments2 Solutions4021 ViewsLast Modified:
When I get a list of users or groups who have mailbox access to another user or group, how can I turn that list of users from domain\username into their display names?  

I'm trying this from the Exchange powershell after importing ActiveDirectory module:

Get-MailboxPermission -identity JSmith| select user | foreach ($user in $users) {Get-ADUser $user.Name}

But I get this in return:
Unexpected token 'in' in expression or statement.
+ Get-MailboxPermission -identity JSmith| select user | foreach ($user in <<<<  $users) {Get-ADUser $user}
    + CategoryInfo          : ParserError: (in:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken
ASKER CERTIFIED SOLUTION
Rajitha Chimmani
Specialized Technology Analyst

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros