Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Group Membership based on Extension Attributes

$
0
0

I'm trying to build a simple script to modify group membership based on the Extension Attributes of my users.

This is what I have to add users to a group:

get-aduser-filter{extensionattribute1-eq"Sales"}|%{Add-ADGroupMemberSales$_.SamAccountName}

This works perfectly. My problem is that I can’t figure out how to script the removal of a user from a group. I tried…

get-aduser-filter{extensionattribute1-ne"Sales"}|%{Remove-ADGroupMemberSales$_.SamAccountName-confirm:$false}

But this doesn’t seem to work. Any help would greatly be appreciated.

Thank you.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>