# encoding: ascii
# api: powershell
# title: AD-GroupMembers_v2
# description: Use this cmdlet to retrieve the directory objects that are members of a certain group in Active Directory.
# version: 0.1
# type: function
# author: Angel-Keeper
# license: CC0
# function: AD-GroupMembers
# x-poshcode-id: 1739
# x-archived: 2011-01-01T11:41:39
#
# This cmdlet is part of the Quest ActiveRoles Server product.
#
function AD-GroupMembers() {
param (
$Domen,
$Group,
$User
)
if ($User){$Connection = Get-Credential -Credential $user}
if($Connection){$Member = Get-QADGroupMember -Service $Domen -Identity $Group -Credential $Connection -SizeLimit 0 -ErrorAction SilentlyContinue | Sort Name | Format-List Name,NTAccountName,Sid,AccountIsDisabled -AutoSize}
else{$Member = Get-QADGroupMember -Service $Domen -Identity $Group -SizeLimit 0 -ErrorAction SilentlyContinue | Sort Name | Format-List Name,NTAccountName,Sid,AccountIsDisabled -AutoSize}
$Member
}