代码改变世界

Remove the Disabled AD Users' Mailbox

2019-08-12 14:37  酷小哈  阅读(275)  评论(0)    收藏  举报

1. 找出已经禁用的AD账号

get-Mailbox | get-user | where {$_.UserAccountControl -match "AccountDisabled"}

2. 禁用账号邮箱

disable-mailbox  -identity  user@domain.com