最近,我编写了代码以从所有组中删除用户并分配4个用户。我需要知道如何使用Power Shell为AD中的用户清除电话
Import-Module ActiveDirectory
$User1 = Read-Host -Prompt 'Enter the username of the employee you wish to change'
Disable-AdAccount -Identity $User1
Get-ADUser -Identity $User1 -Properties MemberOf | ForEach-Object {
$_.MemberOf | Remove-ADGroupMember -Members $_.DistinguishedName - Confirm:$false #| ittest -manager $null
Add-ADGroupMember -Identity "#Group1" -Members $User1
Add-ADGroupMember -Identity "#Group2" -Members $User1
Add-ADGroupMember -Identity "#Group3" -Members $User1
Add-ADGroupMember -Identity "#Group4" -Members $User1
}
我也不确定删除“ manager”字段应该是这种方式...