Hi,
I use something similar to the below to get a list of accounts with permisisons on a mailbox:
$username = "SOMEACCOUNT"
$mailbox = Get-Mailbox $username
$faperms = $mailbox | Get-MailboxPermission -ErrorAction Stop | Where-Object { ($_.IsInherited -eq $false) -and ($_.User -notlike "NT AUTHORITY\*") -and ($_.User -notlike "Domain\$username") } | Sort-Object User
A matter of months ago, this used to return an object like so:
RunspaceId : 3b6g8ac6-bb3d-4wy0-b898-834c10a7fq71 AccessRights : {FullAccess} Deny : False InheritanceType : All User : EURPR08B123\itsx43604-1411484821 Identity : SOMEACCOUNT IsInherited : False IsValid : True ObjectState : Unchanged
Note the user property. I thought this was a little odd (querying local Exchange 2010 returns a samaccountname), but it wasn't a huge problem because I was able to handle this with an if condition (stripped down code for this post):
foreach($perm in $faperms) { if($perm.User -match "EURPR0") { $permUser = (Get-User $perm.User).Identity } }
... and this would give me a username (samaccountname).
However recently the return for the User property has changed. The same command now returns the DisplayName of the user who has full access permission on the mailbox object. DisplayName is not unique, so this could pose a potential problem if you're trying
to translate the User property into an identifiable account.
Anyone have any thoughts on this? It seems as though the cmdlet has changed in the way it functions but is it still not quite right? Should this go on Connect? Is there a sure fire workaround?
Regards,
Robin