![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Get group membership Hello, I am using the following code to obtain group membership: $group = [ADSI] "LDAP://cn=group,ou=OU,dc=domain,dc=org" $group.member This works fine. I now want to write this to html so use $group.member | convertto-HTML But this simply displays numbers and not the group members... I also get numbers if I use export-csv. Does anybody know of a way to get group membership and output it to html or csv? Thanks |
My System Specs![]() |
| | #2 (permalink) |
| Vista Ultimate 32bit | Re: Get group membership I know we solved this in the ScriptingAnswers.com forums but for readers who don't frequent that site here's what I posted: The problem is that the output of Member is simply a string. The number is the length of the string. What you need to do is get each account, some properties and then convert to html or whatever. Here's an example: $group.member | foreach {$user=[adsi]"LDAP://$_"; $user | Select @{name="DN";Expression={$_.DistinguishedName}} ,@{name="name";Expression={$_.Name}},@{name="Title";Expression={$_.Title}}} | convertto-html |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Get group membership Hello David, Adding to Jeffrey, use select-object to 'convert' the piped strings to custom objects using a calculated property and then assign the 'new' property name to ConvertTo-Html: PS > $group.member | select @{n="DN";e={$_}} | ConvertTo-Html -Property DN --- Shay Levy Windows PowerShell MVP http://blogs.microsoft.co.il/blogs/ScriptFanatic DA> Hello, DA> DA> I am using the following code to obtain group membership: DA> DA> $group = [ADSI] "LDAP://cn=group,ou=OU,dc=domain,dc=org" DA> $group.member DA> DA> This works fine. I now want to write this to html so use DA> DA> $group.member | convertto-HTML DA> DA> But this simply displays numbers and not the group members... DA> DA> I also get numbers if I use export-csv. DA> DA> Does anybody know of a way to get group membership and output it to DA> html or csv? DA> DA> Thanks DA> |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Check group membership across domains | PowerShell | |||
| check group membership | PowerShell | |||
| Get Group Membership for a User | PowerShell | |||
| Group Membership | Vista mail | |||
| ADSI and group membership - what am I doing wrong | PowerShell | |||