Here is the script I'm using to get all mailboxes where 'HelpDeskUser' has full permission to. The text file contain SamaccountName of the mailboxes I'm interested.
$emails = GC D:\Data\users.txt
$emails | ForEach-Object {
Get-Mailbox -Identity $_ | Get-MailboxPermission |? {$_.user -like "HelpDeskUser*" }} |select name, primarysmtpAddress,alias |out-file D:\Data\mailboxPermission.txt
However, I'm not getting any output. What I am I doing wrong?
is this in Exchange 2013/16/19? or exchange online?