I saw many examples that allows removal of members from AD Group however, after going through the documentation on Microsoft community I came to know that ObjectGUID is also usable for performing the same operations. I have the GUID of Group & GUID of different members(that I want to remove) how do I perform operation in power shell script?<\/p>\n
I tried doing this but it didn’t work.<\/p>\n
$GroupGUID = 'a3d65150-1739-4cc7-80d2-7b97c76b0aff'\nGet-ADGroupMember -Identity $GroupGUID |\n Where-Object {$_.ObjectGUID -eq '8a3fab53-4c8b-483d-89f0-e26de236a627'} |\n ForEach-Object {Remove-ADGroupMember $GroupGUID $_ -Confirm:$false}\n<\/code><\/pre>\n
Advertisement
Is it suppose to work both the GroupGUID & ObjectGUID are unique for Ad Groups & AD Users in the Active Directory Domain.<\/p>","upvoteCount":6,"answerCount":6,"datePublished":"2019-06-17T20:08:26.000Z","author":{"@type":"Person","name":"spiceuser-ldus","url":"https://community.spiceworks.com/u/spiceuser-ldus"},"suggestedAnswer":[{"@type":"Answer","text":"
I saw many examples that allows removal of members from AD Group however, after going through the documentation on Microsoft community I came to know that ObjectGUID is also usable for performing the same operations. I have the GUID of Group & GUID of different members(that I want to remove) how do I perform operation in power shell script?<\/p>\n
I tried doing this but it didn’t work.<\/p>\n
$GroupGUID = 'a3d65150-1739-4cc7-80d2-7b97c76b0aff'\nGet-ADGroupMember -Identity $GroupGUID |\n Where-Object {$_.ObjectGUID -eq '8a3fab53-4c8b-483d-89f0-e26de236a627'} |\n ForEach-Object {Remove-ADGroupMember $GroupGUID $_ -Confirm:$false}\n<\/code><\/pre>\nIs it suppose to work both the GroupGUID & ObjectGUID are unique for Ad Groups & AD Users in the Active Directory Domain.<\/p>","upvoteCount":6,"datePublished":"2019-06-17T20:08:26.000Z","url":"https://community.spiceworks.com/t/using-guid-to-remove-member-from-ad-group/716810/1","author":{"@type":"Person","name":"spiceuser-ldus","url":"https://community.spiceworks.com/u/spiceuser-ldus"}},{"@type":"Answer","text":"
If you post code, please use the ‘Insert Code’ button. Please and thank you!<\/p>\n