Powershell to get the number of mails in the Inbox and number of unread emails in Inbox

Powershell using Outlook.Application to pull out the mailbox details

$outlook = new-object -com Outlook.Application
$session = $outlook.Session
$session.Logon()
$inbox = $outlook.session.GetDefaultFolder(6)
$unreadCount = (%{$inbox.Items | where {$_.UnRead}}).Count
Write-Host $unreadCount
$ItemCount = (%{$inbox.Items }).Count
Write-Host $ItemCount