Can someone tell me why this simple script will not catch any exceptions? What am I missing?
$mbxs = Get-Content C:\temp\users.txt
foreach ($mbx in $mbxs){
Try{Get-mailbox $mbx| Out-Null
Write-Output "$mbx exists"
}
Catch [System.exception]
{write-host "$mbx doesnt exist"}
}
when the script comes across a mailbox that cant be found it throws the error on the screen but does not do the write host command.