Add ToLocalGroup - PPOSHGROUP/PPoShTools GitHub Wiki

Add-ToLocalGroup

PPoShTools -> Add-ToLocalGroup.ps1

Synopsis

Adds a user or a group to local administrators of a remote computer

Syntax

Add-ToLocalGroup [-ComputerName] <String[]> [-Group] <String> [[-DomainName] 
<String>] [-Type] <String> [-Identity] <String> [<CommonParameters>]

Parameters

-ComputerName<String[]> (default: localhost)

Destination computer name where to add user or group (Identity parameter).

  • DefaultValue: localhost
  • PipelineInput: false
  • Required: true

-Group<String>

Destination local group the Identity should be added to.

  • PipelineInput: false
  • Required: true

-DomainName<String>

Domain name - required for user/group string creation. Can be a workgroup or local computer name instead of domain name.

  • PipelineInput: false
  • Required: false

-Type<String>

Type of identity to add - user or group.

  • Valid values: User, Group
  • PipelineInput: false
  • Required: true

-Identity<String>

Identity of a user/group to add. Provide samaccountname

  • PipelineInput: false
  • Required: true

Examples

Example 1

This will add 'someuser' to 'somecomputer' as local administrator for default domain Objectivity

Add-ToLocalGroup -ComputerName 'somecomputer' -Group Administrators -Type User -Identity 'someuser'

⚠️ **GitHub.com Fallback** ⚠️