PowerShell script exchange
Post Reply
Turranx
Lurker
Posts: 2
Liked: never
Joined: Sep 26, 2019 4:01 pm
Full Name: Gregory DeCecco
Contact:

Email Address Missing

Post by Turranx »

I am using PowerShell to look at several on-prem Exchange mailbox backups. I've noticed that all of the mailbox objects provide a user name (ex. "Smith, Joe"), and all of the mailbox objects have a property called 'Email', but they are all empty. I've looked through the backups of 21 on-prem Exchange servers and all 33,000 mailboxes do not list an email address. Is there a permission my account is missing?

Code: Select all

Add-PSSnapin VeeamPSSnapin;
Import-Module Veeam.Archiver.PowerShell;
Import-Module Veeam.Exchange.PowerShell;
Import-Module Veeam.Sharepoint.PowerShell;
Import-Module Veeam.Oracle.PowerShell;
Import-Module Veeam.SQL.PowerShell;

$RestorePoints = Get-VBRApplicationRestorePoint -Exchange;
$ExchangeServers = $RestorePoints | SELECT -Unique -ExpandProperty Name;

# Build Collection of Newest Restore Points Per Server
$RestorePointsNewest = @();
ForEach ($ExchangeServer in $ExchangeServers) {
    $RestorePointsSubset = $RestorePoints | WHERE {$_.Name -ieq $ExchangeServer} | SORT -Property CreationTime | SELECT -First 1;
    $RestorePointsNewest += $RestorePointsSubset;
    $RestorePointsSubset = $Null;
}

ForEach ($RestorePoint in $RestorePointsNewest) {
        
    Try {
        # NOTE: This may take several minutes
        $Session = Start-VBRExchangeItemRestoreSession -RestorePoint $RestorePoint;

        $ExchangeDatabases = Get-VEXDatabase -Session $Session;
        ForEach ($ExchangeDatabase in $ExchangeDatabases) {
            $Mailboxes = Get-VEXMailbox -Database $ExchangeDatabase;

            ForEach ($Mailbox in $Mailboxes) {
                $ReportObject                    = "" | SELECT -Property 'RestorePointTime','ExchangeServer','ExchangeDatabase','MailboxName','MailboxEmail';
                $ReportObject.RestorePointTime   = $RestorePoint.CreationTime;  # Example: "6/11/2019 7:01:26 AM"
                $ReportObject.ExchangeServer     = $RestorePoint.Name;          # Example: "ExchangeServer01"
                $ReportObject.ExchangeDatabase   = $ExchangeDatabase.Name;      # Example: "DAG1DB13.edb"
                $ReportObject.MailboxName        = $Mailbox.Name;               # Example: "Smith Joe"
                $ReportObject.MailboxEmail       = $Mailbox.Email;              # Example: ""    <-- Always empty

                $ReportCollection += $ReportObject;
            }
        }
    }
    Catch {
        Write-Host $Error;
    }
    Finally {
        # NOTE: This may take several minutes
        Stop-VBRExchangeItemRestoreSession -Session $Session;
    }
}
veremin
Product Manager
Posts: 20271
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Email Address Missing

Post by veremin »

Can you reproduce the same problem in UI? Can you see email address in Exchange Explorer UI? Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests