In our company, we store the name of the building in which an employee works in one of the ActiveDirectory attributes named extensionAttribute# where # represents a number form 1-15. I want to be able to store the names of buildings in the AD attribute named "buildingName". According to the buildingName attribute in the MSDN library, the syntax is "String(Unicode)".
buildingName attribute - https://msdn.microsoft.com/en-us/library/ms675250(v=vs.85).aspx
String(Unicode) syntax - https://msdn.microsoft.com/en-us/library/ms684455(v=vs.85).aspx
When I try something that seems simple to write some text into this attribute such as
Set-QADUser jdoe -ObjectAttributes @{buildingName="My Building Name"}
I get an error that says "Set-QADUser : The requested operation did not satisfy one or more constraints associated with the class of the object."
I have been searching forums and code libraries for a solution to this issue, but I do not understand why I can't store string data into this attribute. I did try the following code snippets to try to convert the string to Unicode (and UTF-8) before I wrote to the buildingName attribute, but I still get the same error.
$text ="My Building Name"
$enc =[System.Text.Encoding]::Unicode
# $enc = [System.Text.Encoding]::UTF8
$encText = $enc.GetBytes($text)
$encText
Set-QADUser jdoe -ObjectAttributes@{buildingName=$encText}
Has anyone else had this issue or know how to overcome it? I can, of course, continue to use the extensionAttribute in which I currently have the data stored, but I really want to free it up and use the "buildingName" attribute.