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
Post a Comment