简体   繁体   中英

Powershell not accepting variables for Get-Mailbox CMDLET

I am just curious if anyone else is having this issue today. I've tried on a couple of machines and get the same results.

1) Get-Mailbox first.last@domain.com = Functional as usual

2) foreach($mb in $mbs){Get-Mailbox $mb.SMTP} = Returns an error that 'first.last@domain.com' cannot be found.

I have verified that $mb.SMTP is actually first.last@domain.com and, as indicated in the error, there are no spaces or unusual characters. I've even tried $smtp = $mb.SMTP and verified the SMTP is correct and without spaces and the errors are the same. I then tried the filter with the same techniques and it returned an error stating

"Property PrimarySmtpAddress does not support Microsoft.Exchange.Data.ExistsFilter. Only Microsoft.Exchange.Data.ComparisonFilter is supported."

I am under the impression that they changed something, and I was hoping to get some feedback from others.

Try this:

foreach($mb in $mbs){Get-Mailbox $mb.SMTP.trim()}

if that works, it means that you've got trailing whitespace in the SMTP property of those $mb objects that's making the Get-Mailbox fail.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM