Get-Group

Gets local groups.

Syntax

Get-Group [[-Name] <String>] [<CommonParameters>]

Description

Get-Group gets all local groups or a specific group by its name.

The objects returned, DirectoryServices.AccountManagement.GroupPrincipal, use external resources, which means they don't clean up propertly when garbage collected, resulting in memory leaks. You should call Dispose() on the objects you receieve from this function when you're done using them so these external resources can be cleaned up correctly.

Get-Group is new in Carbon 2.0.

Related Commands

Parameters

Name Type Description Required? Pipeline Input Default Value
Name String

The name of the group to return.

false false

Return Values

System.DirectoryServices.AccountManagement.GroupPrincipal.

EXAMPLE 1

Get-Group

Demonstrates how to get all local groups.

EXAMPLE 2

Get-Group -Name RebelAlliance

Demonstrates how to get a specific group.