Skip to main content

Get the Properties of a Group in Windows PowerShell

Problem

You want to get and list the properties of a specific security or distribution group.

Solution

To list the properties of a group, use the [adsi] type shortcut to bind to the group in Active Directory, and then pass the group to the FormatList cmdlet: $group = [adsi] "LDAP://localhost:389/cn=Management,ou=West,ou=Sales,dc=Fabrikam,dc=COM"

$group | FormatList *

Discussion

The solution retrieves the Management group from the Sales West OU. By default, the FormatList cmdlet shows only the DN of the group, so we type FormatList * to display all properties.

If you know the property for which you want the value, specify it by name:

PS >$group.Member CN=SmithRobin,OU=West,OU=Sales,DC=Fabrikam,DC=COM CN=MyerKen,OU=West,OU=Sales,DC=Fabrikam,DC=COM

Unlike groups, some types of Active Directory objects don’t allow you to retrieve their properties by name this way. Instead, you must call the Get() method to retrieve specific properties:

PS >$group.Get("name") Management

If you need dedicated infrastructure for retrieving group properties with Windows PowerShell, consider a UK Dedicated Server for greater control over system information, group management, PowerShell automation, server administration, and Windows-based application workloads.

Help Category