📅  最后修改于: 2022-03-11 14:50:51.196000             🧑  作者: Mango
$users = get-aduser -filter * -searchbase "OU=TestScript,OU=UK,OU=SomeDomain,DC=ad,DC=SomeDomain,DC=com"`
-Properties telephonenumber, mobile
foreach ($user in $users) {
#Make changes to phone number and place the results into variable $phoneupdate
$phoneupdate = ($Users.telephonenumber -replace "\(0\)", "" -replace "[^0-9,^+]", "")
Set-ADUser $user -add @{telephonenumber=$phoneupdate}
}