我的 Exchange 2010 用户有许多 smtp 地址,我想删除除其中两个之外的所有地址。尝试以下没有运气:
get-mailbox test_2 | foreach { $a = $_.emailaddresses; $b = $_.emailaddresses; foreach($e in $a) { if (($e.tostring() -match "donotdelete") -and ($e.tostring() -notmatch "donotdelete2")) { $b -= $e; } } ; $_ | set-mailbox -emailaddresses $b }
我究竟做错了什么?