How to Remove Active Directory multiple users from the Multiple Group using PowerShell
Csv file format
for Users
Csv file format
for Groups
Try
{
$users = import-csv C:\Temp\Users.csv
$groups = import-csv C:\Temp\Groups.csv
Foreach ($user
in $users){
Foreach
($group in
$groups) {
Remove-adgroupmember
-Identity $group.GroupName -members
$user.SamAccountName
-Confirm:$false
}
}
}
Catch
{
Write-Host "An error occurred:"
Write-Host $_
}
difficlute to understand if possible merage csv
ReplyDelete