PoshCode Archive  Artifact [aec3c38144]

Artifact aec3c381448aed50e2ca0612538aeec55f0c7b7f437d617a29ef734091241b65:

  • File AD-GroupMembers_v2.ps1 — part of check-in [27bf09367f] at 2018-06-10 13:00:41 on branch trunk — Use this cmdlet to retrieve the directory objects that are members of a certain group in Active Directory. (user: Angel-Keeper size: 973)

# 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
}