Set Note on Telephone tab

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
"@             
            
"`nMicrosoft"            
$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            
             
"`nQuest"            
$name = "UserC"            
Get-QADUser -Identity $name |            
Set-QADUser  -ObjectAttributes @{info=$note}            
            
"`nScript"            
$name = "UserD"            
$dn = "cn=$name,$ou"            
$user = [adsi]"LDAP://$dn"            
$user.info = $note            
$user.SetInfo()


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.

Leave a Reply