For this one you need to have RSAT (Remote Server Administration Tools) installed
You could install that with the following line:
Add-WindowsFeature RSAT-AD-Powershell
#Importing the AD Module
Import-Module ActiveDirectory
#Collect all the Lync users and store as a variable
$users = Get-CSUser
#The foreach loop
Foreach ($user in $users)
{
   $Tel = $user.LineURI
   $Tel = $Tel.Replace("tel:", "")
   If ($Tel -ne "")
   {
      Set-ADUser -Identity $user.SAMAccountName -OfficePhone $Tel
   }
}
 
No comments:
Post a Comment