Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

powershell script to change phone number in ad

$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}

}
Source by community.spiceworks.com #
 
PREVIOUS NEXT
Tagged: #powershell #script #change #phone #number #ad
ADD COMMENT
Topic
Name
7+4 =