Get ADUserGroup - PPOSHGROUP/PPoShDemo GitHub Wiki

Get-ADUserGroup

PPoShDemo -> Get-ADUserGroup.ps1

Synopsis

Retrieves all groups user belongs to from specified OU.

Syntax

Get-ADUserGroup [-Identity] <String[]> [[-SearchOU] <String>] 
[<CommonParameters>]

Description

Retrieves all groups user belongs to from specified OU. If no OU is specified then domain root is set as default.

Parameters

-Identity<String[]>

Can take username or multiple usernames as a parameter.

  • PipelineInput: true (ByValue, ByPropertyName)
  • Required: true

-SearchOU<String> (default: (Get-ADDomain).DistinguishedName)

Expects DN of an OU. If not provided will deafult to root domain DN.

  • DefaultValue: (Get-ADDomain).DistinguishedName
  • PipelineInput: false
  • Required: false

Examples

Example 1

Get-ADUserGroup -Identity 'someuser'

Will query for all groups 'someuser' belongs to in current Domain

Example 2

Get-ADUserGroup -Identity 'someuser' -SearchOU 'OU=Security Groups,OU=SOME_OU,DC=corp,DC=org'

Will query for all groups from Security Groups in SOME_OU 'someuser' belongs to in current Domain.

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