PoshCode Archive  Artifact [36c151285e]

Artifact 36c151285edd5506a91b5bf1546d79534148f486b599d1e4fabe0fb4f74c2a36:

  • File AD-GroupMembers_v1.ps1 — part of check-in [c4073f97cc] at 2018-06-10 13:00:40 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: 1002)

# encoding: ascii
# api: powershell
# title: AD-GroupMembers_v1
# 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: 1738
# x-derived-from-id: 1739
# x-archived: 2011-01-02T20:11:21
#
# 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-Table Name,NTAccountName,Sid,AccountIsDisabled -AutoSize}
else{$Member = Get-QADGroupMember -Service $Domen -Identity $Group -SizeLimit 0 -ErrorAction SilentlyContinue | Sort Name | Format-Table Name,NTAccountName,Sid,AccountIsDisabled -AutoSize}
$Member
}