4 September 2013

Set TelURI from AD Office Phone

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