添加邮件提示
- 定义离职员工
- $Offpost = ‘xianqi’
- 禁用AD账号
- Get-ADUser -Identity $Offpost | Disable-ADAccount
- 查看所在的通讯组并迁移到离职员工OU
- $ObjectGuid01 = (Get-ADUser -Identity $Offpost | Select-Object objectGuid).objectGuid.Guid
- Move-ADObject -Identity $Offpost -TargetPath ‘OU=10月,OU=2023年,OU=离职员工,DC=abc,DC=com’
- Move-ADObject -Identity $ObjectGuid01 -TargetPath ‘OU=10月,OU=2023年,OU=离职员工,DC=abc,DC=com’
- Add-DistributionGroupMember -Identity Ex-Employee -Member $Offpost
- 从所有组中删除离职账号,添加邮件提示
- Set-Mailbox -Identity $Offpost -MailTip ‘我已离职,邮箱已停用.’
- Get-DistributionGroupMember -Identity Ex-Employee
- Get-ADPrincipalGroupMembership $Offpost | select Name