< Back

Get-CGroup

Sun Jan 12, 2020 9:42 pm

NAME Get-CGroup



SYNOPSIS

Gets *local* groups.





SYNTAX

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





DESCRIPTION

`Get-CGroup` 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-CGroup` is new in Carbon 2.0.





PARAMETERS

-Name <String>

The name of the group to return.



Required? false

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

System.DirectoryServices.AccountManagement.GroupPrincipal.





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-CGroup



Demonstrates how to get all local groups.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-CGroup -Name RebelAlliance



Demonstrates how to get a specific group.











RELATED LINKS

Get-CUser