remove multiple people from a single group in Active Directory
i trying remove multiple users active directory group. have list of users user id (account id). , group changes depending on need. there way create script request name of ad group, find it, , ask list of users remove? (cut n paste?) have no idea how go starting this. , apreciated.
get-help remove-adgroupmember
will show needed, , want use. there many ways go this, -members property takes in array of adprincipal object, can multiple users 1 command
$group = read-host "type name of group , hit enter" $users = get-content c:\users.txt remove-adgroupmember -identity $group -members $users
work, have not tested though, , there no error checking, basically, when ran prompts user name of group, users removed in text file, line line, use samaccountname in text file.
if find post has answered question, please mark answer. if find post helpful in anyway, please click vote helpful.
Windows Server > Windows PowerShell
Comments
Post a Comment