Power shell script to get member names from AD security groups

 # Import the Active Directory module

Import-Module ActiveDirectory


# Define the security group name

$GroupName = "YourSecurityGroupName"


# Get the members of the security group

$GroupMembers = Get-ADGroupMember -Identity $GroupName


# Loop through each member and display the name

foreach ($Member in $GroupMembers) {

    Write-Output $Member.name

}


Comments

Popular posts from this blog

How to Improve Workflow Performance in SharePoint Server 2010

PowerShell Script to Check and Generate Report on Access Rights for a Specific User:

Disable Loopbackcheck using PowerShell