header image

Set Note on Telephone tab

Posted by: | March 4, 2012 | No Comment |

The telephone tab in AD Users and Computers has a Notes section. This can be manipulated in a similar manner to the street address field on the Address tab. The Notes field on the GUI stores its data in the info attribute.

$ou = "OU=BlogTests,DC=Manticore,DC=org"            
$note = @"
Once upon a time something happened

In a galaxy far away
$name = "UserA"            
Get-ADUser -Identity $name |            
Set-ADUser -Replace @{info = $note}            
"`nAD provider"            
$name = "UserB"            
$dn = "cn=$name,$ou"            
Set-ItemProperty -Path AD:\$dn  -Name info -Value $note  -Force            
$name = "UserC"            
Get-QADUser -Identity $name |            
Set-QADUser  -ObjectAttributes @{info=$note}            
$name = "UserD"            
$dn = "cn=$name,$ou"            
$user = [adsi]"LDAP://$dn"            
$user.info = $note            

Use a here-string to create the text – ensures line breaks are honoured.

Use the –Replace parameter with the Microsoft cmdlets and –ObjectAttributes with Quest cmdlets.

The provider requires Set-ItemProperty and the script is a straight setting of the info attribute.

under: PowerShell and Active Directory