Exchange Management shell help
I'm trying to locate all mailboxes with an incorrect Primary SMTP address. I'm running the query get-mailbox | where { $_.PrimarySMTPAddress -eq "*tetonhosp.com"} The query fails to return records, but a quick look in the Management Console shows that records exist. What's wrong with my query?
January 14th, 2010 6:54pm
Try this:get-mailbox | where { $_.PrimarySMTPAddress.domain -eq "*tetonhosp.com"}
Free Windows Admin Tool Kit Click here and download it now
January 14th, 2010 6:58pm
You must remove the asterisk, but I guess that it is a leftover from a copy / paste operation.
MCTS: Messaging | MCSE: S+M | Small Business Specialist
January 14th, 2010 10:14pm
On Thu, 14-Jan-10 15:54:32 GMT, dwitton wrote:>I'm trying to locate all mailboxes with an incorrect Primary SMTP address. I'm running the query get-mailbox | where { $_.PrimarySMTPAddress -eq "*tetonhosp.com"} The query fails to return records, but a quick look in the Management Console shows that records exist. What's wrong with my query? I suppose that depends on what you expect the query to be doing. :-)If you intended the "*" to be used as a wildcard, change the operator"-eq" to "-like".---Rich MatheisenMCSE+I, Exchange MVP
---
Rich Matheisen
MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
January 15th, 2010 6:44am
Indeed, the asterisk was intended as a wildcard - modifying the operator solved my problem. The suggestion about further qualifying the address with ".domain" was a more elegant solution than I had imagined and solved my problem as well.
January 15th, 2010 7:10pm