Find an Exchange User’s Resources

You can use these PowerShell commands in the Exchange Management Shell to find all the Room and Equipment mailboxes for which a particular user is a delegate:

# Gets the mailbox name from the user.
$Username = Read-Host “What is the username for the mailbox?”

# Assigns the mailbox to a variable called “Mailbox”.
$Mailbox = Get-Mailbox $Username

# Assigns the mailbox name to a variable called MBName
$MBName = $Mailbox.Name

# Gets a list of all Room and Equipment type mailboxes on the
# system and assigns the list to a variable called “ResourceMailboxes”
$ResourceMailboxes = (Get-Recipient -resultsize Unlimited | Where-Object `
{$_.ResourceType -eq “Room” -or $_.ResourceType -eq “Equipment”})

# Output a list of resource mailboxes for which the user is a delegate
$ResourceMailboxes | ForEach {$ResourceName = $_.Alias;Get-CalendarProcessing `
$ResourceName | Select -ExpandProperty ResourceDelegates | ForEach-Object `
{$NameInDelList = $_.Name; if($MBName -eq $NameInDelList) {$ResourceName}}}

If you want to assign the list of resource mailboxes to a variable to use later, just modify that last line to something like this:

$ManagedResources = ($ResourceMailboxes | foreach {$resourcename = $_.Alias; `
Get-CalendarProcessing $resourcename | select -expandproperty resourcedelegates `
| foreach-object {$NameInDelList = $_.Name; if($MBName -eq $NameInDelList) `
{$resourcename}}})

Leave a Reply

Your email address will not be published.