Get-MailboxFolderStatistics shows only number

33 views Asked by At

I try to create a simple Powershell Exchange Online Shell to get total items in specific folder of mailbox.

$myJob1 = ((Get-Mailbox -Identity [email protected] | Get-MailboxFolderStatistics -FolderScope DeletedItems | Select ItemsInFolder)| Out-String).Trim()
if($myJob1 -eq "5000")
{
    Write-Host("Equal")
}
else
{
    Write-Host("Not equal")
}

But the result of $myJob1 always return like that:

ItemsInFolder
-------------
         3675

Instead I just need only number 3675 and nothing more.

How can I fixed that with my code, please.

0

There are 0 answers