如何在AD中从用户删除电话号码

时间:2018-07-04 10:31:50

标签: windows active-directory powershell-v4.0

最近,我编写了代码以从所有组中删除用户并分配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”字段应该是这种方式...

0 个答案:

没有答案