I have a script to create a hashtable with usernames as the key and an array of their groups as the value.
Here is what it looks like:
Name Value
---- -----
user1 {Domain Users, group2, group3}
user2 {Domain Users, group4}
user3 {Domain Users, group2, group3, group4}
How can I export this into a CSV file using the username as the heading?
When I import the CSV file into Excel I want it to look like this:
A B C ------------------------------------------- 1 | user1 user2 user3 2 | Domain Users Domain Users Domain Users 3 | group2 group4 group2 4 | group3 group3 5 | group4
I have played around with Export-Csv but cannot get it to work for this type of hashtable.