I would like to remove all users from groups. My issue is the fact that I have GroupNames that contain '@' so it fails... any help will be appreciate. Thanks
$groupNames = @"
Groups;
@Test-Group-FIN #fail
@Test-Group-HR #fail
SupportGAP #it works for this group
"@ | Convertfrom-csv -Delimiter ";"
#Remove members
foreach ($ADGroup in $groupNames) {
Get-ADGroupMember -Identity $ADGroup.Groups.Trim() | ForEach-Object {Remove-ADGroupMember $ADGroup.Groups.Trim() $_ -Confirm:$False }
}