ndalmolin_13
asked on
Help with a PowerShell script that will identify users not members of a particular group
Hello All,
Our director's boss was trying to send a global email and received a hand full of non-delivery reports. He was not happy about this and tasked us with making sure all domain users are part of a mail enabled security group called Global.
I want to use PowerShell to get a list of users that are not part of the Global group. I have the Quest Active Directory commandlets loaded, so I'm using those in my attempts. Here is what I thought would work:
get-qaduser | where{$_.memberof -ne "global"}
This isn't returning what I expected. I'm getting a message about only displaying the first 1000 results. Based on the number of non-delivery reports our director's boss received, there should only be between 50 and 75 users that are not part of the Global group.
Any help would be greatly appreciated.
regards,
Nick
Our director's boss was trying to send a global email and received a hand full of non-delivery reports. He was not happy about this and tasked us with making sure all domain users are part of a mail enabled security group called Global.
I want to use PowerShell to get a list of users that are not part of the Global group. I have the Quest Active Directory commandlets loaded, so I'm using those in my attempts. Here is what I thought would work:
get-qaduser | where{$_.memberof -ne "global"}
This isn't returning what I expected. I'm getting a message about only displaying the first 1000 results. Based on the number of non-delivery reports our director's boss received, there should only be between 50 and 75 users that are not part of the Global group.
Any help would be greatly appreciated.
regards,
Nick
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The Where-Object alternative is....
Get-QADUser | ?{ !($_.MemberOf -Match "Global") }
The LdapFilter is more efficient though.
Chris
lol or that :)
Chris
ASKER
- Get-Qaduser -NotMemberOf Global