Get-Mailbox -> results (Identity contents <> for same command but <> out statement .

Dear,
I want to return all mailboxes where a specific user has fullAccess rights  (btw this is taking minutes to get results :()


Strange enough the 2 commands do not return same identity values.... (but for sure the same mailboxes)

(Param $strUser)
Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission -user $strUser | ? {($_.AccessRights -match "FullAccess") -and -not ($_.User -like "NT AUTHORITY\SELF")} | ft Identity | ConvertTo-HTML  | Out-File C:\users\ADExc_FullAccess.html
-> this return an identity on hexa

Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission -user $strUser | ? {($_.AccessRights -match "FullAccess") -and -not ($_.User -like "NT AUTHORITY\SELF")} | ft Identity
->This return an identity which is readable.


Q2 : How to return the display name rather than Identity ?
François VDCIcT service DeskAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tom CieslikIT EngineerCommented:
Strange, I have same output.
On the screen is OK but in file is only ClassID instead of Identity

I've try to put output to TXT file and is working.

Check if this will be OK for you (I've removed converter and forwarded stream to txt)

Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission -user $strUser | ? {($_.AccessRights -match "FullAccess") -and -not ($_.User -like "NT AUTHORITY\SELF")} | ft Identity | Out-File C:\users\ADExc_FullAccess.txt
0
François VDCIcT service DeskAuthor Commented:
PS I have found. Do not use FT but Select and you have the expected result for Identity....

I fact I would prefer to have Display Name (that's the reason for Q2...)
any idea how to get other information like Display Name instead of Identity  is welcome....

and/or any other command which is quicker to get same result....
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
General note: Never use format-* for anything else than output to the console screen. It applies a lot of formatting, adds formatting objects, and applies some magic, all working only on displays.
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Regarding speed, there is not a lot you can do. You can try to avoid conversions and pattern matching:
get-mailbox | Get-MailboxPermission -user $strUser | ? { $_.AccessRights -contains [Microsoft.Exchange.Management.RecipientTasks.MailboxRights]::FullAccess -and $_.User -ne 'NT AUTHORITY\SELF'} | select Identity

Open in new window

To get the display name, you have to ask Active Directory:
get-mailbox | Get-MailboxPermission -user $strUser | ? { $_.AccessRights -contains [Microsoft.Exchange.Management.RecipientTasks.MailboxRights]::FullAccess -and $_.User -ne 'NT AUTHORITY\SELF'} | Get-user | Select DisplayName | ConvertTo-HTML | Out-File "C:\users\ADExc_FullAccess-$strUser.html"

Open in new window

I've also integrated the user name into the file name.
0
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
I don't see how your own comment was helpful at all here, Tom?
0
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
What the Asker found is correct, but only the first step, as it only shows the ID. My explanation of why it makes a difference is immediately following their comment (and is an assist candidate for that reason).

My next comment addresses the real request - display names, and adds info about performance.

The question is complete if accepting
   #a42398780
   #a42399409
optionally
   #a42399389
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.