用于在交换地址列表中隐藏用户的 Powershell 命令
我正在尝试编写将用户隐藏在交换列表中的 powershell 脚本。
我能够找到以下命令: Set-Mailbox -Identity [user id here] -HiddenFromAddressListsEnabled $true
它不会给我错误消息,当我运行该命令两次时,我收到以下警告:
警告:命令已成功完成,但“[此处的用户 ID]”的设置尚未修改。
这可能意味着该命令确实有效。
但是当我转到 Exchange 管理控制台 并打开用户配置文件时,“从 Exchange 地址列表中隐藏用户
”复选框处于关闭状态。
可能是什么原因?
I'm trying to write powershell script which hides user from exchange lists.
I was able to find following command:Set-Mailbox -Identity [user id here] -HiddenFromAddressListsEnabled $true
And it doesn't give me an error message, and when I run the command twice, I get following warning:
WARNING: The command completed successfully but no settings of '[user id here]' have been modified.
Which probably means that the command did actually work.
but when I go to Exchange Management Console, and open user profile, "hide user from exchange address lists
" check box is off.
What could be the reason?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我将其用作每日计划任务,以从全局地址列表中隐藏在 AD 中禁用的用户
I use this as a daily scheduled task to hide users disabled in AD from the Global Address List
您可以使用以下脚本,只需将 DOMAIN 替换为您的域名即可。执行时,它将提示您进行用户登录,然后从地址列表中隐藏该用户的帐户。
布莱恩.
You can use the following script, just replace DOMAIN with the name of your domain. When executed it will prompt you for a userlogin then hide that user's account from the address lists.
Brian.
我遇到了完全相同的错误,但是我通过先运行
$false
然后运行 $true
解决了它。I was getting the exact same error, however I solved it by running
$false
first and then$true
.您必须将有效的
Identity
值之一(例如DN
、domain\user
等)传递给Set-Mailbox
cmdlet。目前你没有传递任何东西。You will have to pass one of the valid
Identity
values likeDN
,domain\user
etc to theSet-Mailbox
cmdlet. Currently you are not passing anything.“警告:命令已成功完成,但“[此处的用户 ID]”的设置尚未修改。”
此警告意味着该设置已按照您想要的方式设置。所以它没有改变该对象的任何内容。
"WARNING: The command completed successfully but no settings of '[user id here]' have been modified."
This warning means the setting was already set like what you want it to be. So it didn't change anything for that object.
对于 Office 365 用户或混合 Exchange,请转到使用 Internet Explorer 或 Edge,转到 Exchange 管理中心,选择混合、设置,选择混合或在线交换的正确按钮。
连接:
查看相关邮箱:
根据上述 0KB 大小的想法进行阻止:
For Office 365 users or Hybrid exchange, go to using Internet Explorer or Edge, go to the exchange admin center, choose hybrid, setup, chose the right button for hybrid or exchange online.
To connect:
To see the relevant mailboxes:
To block based on the above idea of 0KB size: