Can run and get AD attribut Department Number with PS to show up on screen. But when export it to CSV and open in Excel the Department Number show up as Microsoft.ActiveDirectory.Management.ADPropertyValueCollection
Anyone any idea?
Can run and get AD attribut Department Number with PS to show up on screen. But when export it to CSV and open in Excel the Department Number show up as Microsoft.ActiveDirectory.Management.ADPropertyValueCollection
Anyone any idea?
I’d expect it to be helpful to see your actual code and some (from sensitive information sanitized) example output and the expected output.
Of course. Though I’d post it. My mistake. Will post later.
This isn’t an open discussion so moving to Powershell help category - please post in proper category in future thanks!
Do they have multiple department numbers? When I see that it’s often because the value is a collection or array. I think that one does allow multiple values, If so you may need to use the join operator to combine into a single string. I see it typically with things like directreports etc. Powershell interprets multi value string as arrays, so when you export them, It doesn’t like it.
EDIT: please do share your code, but i’m pretty sure that’s the issue. You probably need to either create a custom object to export to a CSV, or use calculated properties via select-object like so (just doing a single property as an example):
$user | select-Object @{Name='DepartmentNumber'; Expression={$_.DepartmentNumber -join ';'}}