Monthly Archive


Add to Notes field

You may need to add extra information to the notes field

$ou = "OU=BlogTests,DC=Manticore,DC=org"            
$extra = @"

Just a bit more info
$name = "UserA"            
$p = Get-ADUser -Identity $name -Properties *            
$note = $ + $extra            
Set-ADUser -Identity $name -Replace @{info = $note}            
"`nAD provider"            
$name = "UserB"            
$dn = "cn=$name,$ou"            
$p = Get-ItemProperty -Path AD:\$dn  -Name info             
$note = $ + $extra            
Set-ItemProperty -Path AD:\$dn  -Name info -Value $note  -Force            
$name = "UserC"            
$p = Get-QADUser -Identity $name -IncludeAllProperties            
$note = $ + $extra            
Set-QADUser  -Identity $name -ObjectAttributes @{info=$note}            
$name = "UserD"            
$dn = "cn=$name,$ou"            
$user = [adsi]"LDAP://$dn"            
$note = @"

$ = $note            

The Microsoft & Quest cmdlets together with the provider all work in the same way. Get the current attribute value, use string concatenation to add the extra info and write back to AD

The script is slightly different in that we have to create a new here-string by substituting the current value and the new info. The combined data can be written back to AD.  If you try to  use ordinary string concatenation you will get a “The specified directory service attribute or value already exists.” error.

Leave a Reply