Thursday, 18 July 2013

Powershell: How to get members of AD security group

all - AD security group

Get-ADGroupMember all 

Displays only "usernames":
Get-ADGroupMember all | Select SamAccountName

Snippet for Iterating through all users

$Users=Get-ADGroupMember all | Select SamAccountName

foreach ($User in $Users)
{
Write-Host $User.SamAccountName

}

No comments:

Post a Comment