Monday, March 20, 2017

Update AD Group ManagedBy Attribute – PowerShell Script


 

Example 1.

Input File
Groups-170316-1.csv - The input file contains group names.



Script

Import-module ActiveDirectory

$User = "User-170316"

Import-CSV "C:\Scripts\Groups-170316-1.csv" | % {

$Group = $_.GroupName

Get-ADGroup $Group | Set-ADGroup -ManagedBy $User
}

Notes:
$User = <ADUser>


Example 2.

Input File
Groups-170316-2.csv - The input file contains group and user names.


No comments:

Post a Comment