Install-Group

Creates a new local group, or updates the settings for an existing group.

Syntax

Install-Group [-Name] <String> [[-Description] <String>] [[-Member] <String[]>] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]

Description

Install-Group creates a local group, or, updates a group that already exists.

YOu can get a System.DirectoryServices.AccountManagement.GroupPrincipal object representing the group returned to you by using the PassThru switch. This object implements the IDisposable interface, which means it uses external resources that don't get garbage collected. When you're done using the object, make sure you call Dispose() to free those resources, otherwise you'll leak memory. All over the place.

Parameters

Name Type Description Required? Pipeline Input Default Value
Name String

The name of the group.

true false
Description String

A description of the group.

false false
Member String[]

Members of the group.

false false @()
PassThru SwitchParameter

Return the group as a System.DirectoryServices.AccountManagement.GroupPrincipal.

This object uses external resources that don't get cleaned up by .NET's garbage collector. In order to avoid memory leaks, make sure you call its Dispose() method when you're done with it.

false false False
WhatIf SwitchParameter false false
Confirm SwitchParameter false false
CommonParameters This cmdlet supports common parameters. For more information type
Get-Help about_CommonParameters.

Return Values

System.DirectoryServices.AccountManagement.GroupPrincipal.

EXAMPLE 1

Install-Group -Name TIEFighters -Description 'Users allowed to be TIE fighter pilots.' -Members EMPIRE\Pilots,EMPIRE\DarthVader

If the TIE fighters group doesn't exist, it is created with the given description and default members. If it already exists, its description is updated and the given members are added to it.