Sorry, that will give you a list of the users that are in the groups.
To get the list of the ones that aren't:
$grouplist = gc grouplist.txt
$users = get-qaduser -searchroot <path to ou>
Foreach ($user in $users){
$ingroups = $false
Foreach ($group in $grouplist){
If ($user.memberof -contains $group){$ingroups = $true}
}
If (if $ingroups -eq $false){write-host $user}
}
________________________________
From: Campbell, Rob [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 02, 2008 8:34 AM
To: Active Directory Admin Issues
Subject: RE: Scripting
If you have Powershell, and the free Quest cmdlets this should work:
$grouplist = gc grouplist.txt
$users = get-qaduser -searchroot <path to ou>
Foreach ($user in $users){
$ingroups = $false
Foreach ($group in $grouplist){
If ($user.memberof -contains $group){$ingroups = $true}
}
If ($ingroups){write-host $user}
}
The group list and path to the ou need to be the DN's of the groups and
OU. The groups are read from a text file (grouplist.txt), but you can
hard code the list into the script if you want.
Eg
"cn=group1,ou=groups,dc=domain,dc=tld" for the groups
"ou=user groups,dc=domain,dc=tld" for the OU.
If you don't have Powershell yet, what are you waiting for?
________________________________
From: Naresh Kumar [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 02, 2008 8:08 AM
To: Active Directory Admin Issues
Subject: Scripting
~ NEW: CounterSpy Enterprise: Centralized Antispyware - #1 in eWEEK
Test! ~
~ ~
************************************************************************
**************************
Note:
The information contained in this message may be privileged and
confidential and
protected from disclosure. If the reader of this message is not the
intended
recipient, or an employee or agent responsible for delivering this
message to
the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If
you
have received this communication in error, please notify us immediately
by
replying to the message and deleting it from your computer.
************************************************************************
**************************
~ NEW: CounterSpy Enterprise: Centralized Antispyware - #1 in eWEEK
Test! ~
~ ~
**************************************************************************************************
Note:
The information contained in this message may be privileged and confidential
and
protected from disclosure. If the reader of this message is not the intended
recipient, or an employee or agent responsible for delivering this message to
the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify us immediately by
replying to the message and deleting it from your computer.
**************************************************************************************************
~ NEW: CounterSpy Enterprise: Centralized Antispyware - #1 in eWEEK Test! ~
~ <http://www.sunbelt-software.com/product.cfm?id=400> ~