问题
I have created several custom attributes in a test AD environment. Each is a single-valued unicode string that I have added to the user class. The first attribute I created works as expected. When I use get-ADuser -property CusAttribute1 I get back an object with type string. Every other custom attribute I have created I get back an object with type Microsoft.ActiveDirectory.Management.ADPropertyValueCollection.
Domain functional level 2008R2. I am able to extract the array to a string value in the select statement, but I don't understand why two attributes that were created in the same way are performing differently, and I don't want to have to extract the value from the array if I don't have to.
Get-ADuser someUser -Properties cusAttribute1,cusAttribute2 |gm
The expected result would be that cusAttribute 1 and 2 would have a type of String, but instead cusAttribute1 has a type of String and cusAttribute2 has a type of Microsoft.ActiveDirectory.Management.ADPropertyValueCollection and is an array with one value in it.
来源:https://stackoverflow.com/questions/56795088/ad-single-value-custom-attribute-returning-as-multi-valued-in-powershell