How can I change the "Managed By" name in a Security Group in AD to a single user in multiple groups using a csv in powershell?
I would suggest something like this:
$manager = Get-ADUser -Identity "USERNAME"
Import-Csv groups.csv | ForEach-Object {
Set-ADGroup -Identity $_.Group -ManagedBy ($manager.DistinguishedName)
}
You can even skip the Get-ADUser
part and just do:
Import-Csv groups.csv | ForEach-Object {
Set-ADGroup -Identity $_.Group -ManagedBy "USERNAME"
}