Script to find users that are a member of more than one of a list of specific groups
Hi,
I need to generate a list of users that are members in more than one group, out of a list of specific security groups. Here's the situation:
1) We have about 1100 users, all nested under a specific OU called CompanyUsers. There are sub-OUs under CompanyUsers that users may actually be in.
2) We have about 75 groups, all directly under a specific OU called AppGroups. These groups correspond to a user's role within an internal line of business application. All these groups start with a specific character prefix "xyz", so the group
name is actually "xyz-approle".
I want to write a script that tells me if a user from point 1) is a member in more than one group in point 2). So far, I've come up with a way to enumerate the users to an array:
$userlist = get-qaduser -searchroot 'dq.ad/dqusers/doral/remote' | select samaccountname |Format-Table -HideTableHeaders
I also have a way to enumerate all the groups that start with xyz that the user is a member of:
get-QADMemberOf -identity <username> -name xyz* -Indirect
I figure I can use the first code line to start a foreach loop that uses the 2nd code line, outputting to CSV format for easy to see manual verification. But I'm having two problems:
1) How to get the output to a CSV file in the format <username>,groupa,groupb,etc.
2) Is there any easier way to do this, say just outputting the users in more than one group?
Any help/ideas are welcome.
Thanks in advance!
John
Here is a PowerShell script solution. I can't think of way to make this more efficient. You could search for all groups in the specfied OU that start with "xyz", then filter on all users that are members of at least one of these groups. However, I suspect
that most (if not all) users in the OU are members of at least one such group, and there is no way to filter on users that are members of more than one. This solution returns all users and their direct group memberships, then checks each membership to
see if it meets the conditions. It outputs the DN of any user that is a member of more than one specfied group:
# Search CompanyUsers OU.
strUsersOU = "ou=CompanyUsers,ou=West,dc=MyDomain,dc=com"
$UsersOU = New-Object System.DirectoryServices.DirectoryEntry $strUsersOU
# Use the DirectorySearcher class.
$Searcher = New-Object System.DirectoryServices.DirectorySearcher
$Searcher.SearchRoot = $UsersOU
$Searcher.PageSize = 200
$Searcher.SearchScope = "subtree"
$Searcher.PropertiesToLoad.Add("distinguishedName") > $Null
$Searcher.PropertiesToLoad.Add("memberOf") > $Null
# Filter on all users in the base.
$Searcher.Filter = "(&(objectCategory=person)(objectClass=user))"
$Results = $Searcher.FindAll()
# Enumerate users.
"Users that are members of more than one specified group:"
ForEach ($User In $Results)
$UserDN = $User.properties.Item("distinguishedName")
$Groups = $User.properties.Item("memberOf")
# Consider users that are members of at least 2 groups.
If ($Groups.Count -gt 1)
# Count number of group memberships.
$Count = 0
ForEach ($Group In $Groups)
# Check if group Common Name starts with the string "xyz".
If ($Group.StartsWith("cn=xyz"))
# Make sure group is in specified OU.
If ($Group.Contains(",ou=AppsGroup,"))
$Count = $Count +1
If ($Count -gt 1)
# Output users that are members of more than one specified group.
$DN
# Break out of the ForEach loop.
Break
Richard Mueller - MVP Directory Services
Similar Messages
-
Hi,
Power Down, Power Cycle, Take Snapshot and Decommission services are not working for users who are member of more than one organization!!
Error Message:
The service form could not be submitted because of following error: [newscale][SQLServer JDBC Driver][SQLServer]Conversion failed when converting the nvarchar value '1,2' to data type int.
Thanks,
MazHi,
Power Down, Power Cycle, Take Snapshot and Decommission services are not working for users who are member of more than one organization!!
Error Message:
The service form could not be submitted because of following error: [newscale][SQLServer JDBC Driver][SQLServer]Conversion failed when converting the nvarchar value '1,2' to data type int.
Thanks,
Maz -
How can I see if my program is for more than one user? We think we have bought in design for more users, but can not find out how to get in for more than one?
If you bought a CC for team, you can log in at http://adobe.com and insert the e-mail that you gave at the moment at the purchase and than you can manage and see you product/plan/team.
If I was not clear you can use the following link to help you solving your issue:
Creative Cloud Help | Manage your Creative Cloud for teams membership
If your not clear about this situation, contact with an agent of Adobe, by chat or phone. Use the following link to see the type of support you have on this matter:
http://adobe.com/getsupport
I think this will help you.
Regards -
Can a personnel area be assigned to more than one company code?
Hi experts,
Can a personnel area be assigned to more than one company code?
Regards,
Anita GeorgeYes, as Siva said it is not possible.
Between personnel area and company code -
many to one mapping is allowed but one to many is not allowed. That is you can map more than one PA to 1 company code but 1 PA can not be map to more than one company code. -
Is there a datatype that allows me to store more than one item at a time
Hello Everyone,
Is there a datatype that allows me to store more than one item at a time , in a column in a row?
I have to prepare a monthly account purchase system. Basically in this system a customer purchases items in an entire month as and when required on credit and then pays at the end of the month to clear the dues. So, i need to search the item from the inventory and then add it to the customer. So that when i want to see all the items purchased by a customer in the current month i get to see them. Later i calculate the bill and then ask him to pay and flushout old items which customer has purchased.
I am having great difficulty in preparing the database.
Please can anyone guide me! i have to finish this project in a weeks time.
Item Database:
SQL> desc items;
Name Null? Type
ITEMID VARCHAR2(10)
ITEMCODE VARCHAR2(10)
ITEMPRICE NUMBER(10)
ITEMQUAN NUMBER(10)
Customer Database:
SQL> desc customerdb;
Name Null? Type
CUSTID VARCHAR2(10)
CUSTFNAME VARCHAR2(20)
CUSTLNAME VARCHAR2(20)
CUSTMOBNO NUMBER(10)
CUSTADD VARCHAR2(20)
I need to store for every customer the items he has purchased in a month. But if i add a items purchased by a customer to the customer table entries look this.
SQL> select * from customerdb;
CUSTID CUSTFNAME CUSTLNAME CUSTMOBNO CUSTADD ITEM ITEMPRICE ITEMQUANTITY
123 abc xyz 9988556677 a1/8,hill dales soap 10 1
123 abc xyz 9988556677 " toothbrush 18 1
I can create a itempurchase table similar to above table without columns custfname,csutlnamecustmobno,custadd
ItemPurchaseTable :
CUSTID ITEM ITEMPRICE ITEMQUANTITY
123 soap 10 1
123 toothbrush 18 1
ill just have it as follows. But still the CUSTID FK from CustomerDB repeats for every row. I dont know how to solve this issue. Please can anyone help me.
I need to map 1 customer to the many items he has purchased in a month.
Edited by: Yukta Lolap on Oct 8, 2012 10:58 PM
Edited by: Yukta Lolap on Oct 8, 2012 11:00 PMYou must seriously read and learn about Normalization of tables; It improves your database design (at times may increase or decrease performance, subjective cases) and eases the Understanding efforts for a new person.
See the below tables and compare to the tables you have created
create table customers
customer_id number primary key,
fname varchar2(50) not null,
mname varchar2(50),
lname varchar2(50) not null,
join_date date default sysdate not null,
is_active char(1) default 'N',
constraint chk_active check (is_active in ('Y', 'N')) enable
create table customer_address
address_id number primary key,
customer_id number not null,
line_1 varchar2(100) not null,
line_2 varchar2(100),
line_3 varchar2(100),
city varchar2(100) not null,
state varchar2(100) not null,
zip_code number not null,
is_active char(1) default 'N' not null,
constraint chk_add_active check (is_active in ('Y', 'N')),
constraint fk_cust_id foreign key (customer_id) references customers(customer_id)
create table customer_contact
contact_id number primary key,
address_id number not null,
area_code number,
landline number,
mobile number,
is_active char(1) default 'N' not null,
constraint chk_cont_active check (is_active in ('Y', 'N'))
constraint fk_add_id foreign key (address_id) references customer_address(address_id)
create table inventory
inventory_id number primary key,
item_code varchar2(25) not null,
item_name varchar2(100) not null,
item_price number(8, 2) default 0,
item_quantity number default 0,
constraint chk_item_quant check (item_quantity >= 0)
);You may have to improvise and adapt these tables according to your data and design to add or remove Columns/Constraints/Foreign Keys etc. I created them according to my understanding.
--Edit:- Added Purchases table and sample data;
create table purchases
purchase_id number primary key,
purchase_lot number unique key not null, --> Unique Key to map all the Purchases, at a time, for a customer
customer_id number not null,
item_code number not null,
item_price number(8,2) not null,
item_quantity number not null,
discount number(3,1) default 0,
purchase_date date default sysdate not null,
payment_mode varchar2(20),
constraint fk_cust_id foreign key (customer_id) references customers(customer_id)
insert into purchases values (1, 1001, 1, 'AZ123', 653, 10, 0, sysdate, 'Cash');
insert into purchases values (2, 1001, 1, 'AZ124', 225.5, 15, 2, sysdate, 'Cash');
insert into purchases values (3, 1001, 1, 'AZ125', 90, 20, 3.5, sysdate, 'Cash');
insert into purchases values (4, 1002, 2, 'AZ126', 111, 10, 0, sysdate, 'Cash');
insert into purchases values (5, 1002, 2, 'AZ127', 100, 10, 0, sysdate, 'Cash');
insert into purchases values (6, 1003, 1, 'AZ123', 101.25, 2, 0, sysdate, 'Cash');
insert into purchases values (7, 1003, 1, 'AZ121', 1000, 1, 0, sysdate, 'Cash');Edited by: Purvesh K on Oct 9, 2012 12:22 PM (Added Price Column and modified sample data.) -
Hi All, I have two questions. First of all my CS3 is saying that it is installed on more than one machine, is there a way of seeing what machines my serial number is registered to? If i want to buy another CS3 serial number how do i go about it? I cannot afford to move to the creative cloud.....
there's no way for you to identify which machines have or had cs3 activated, and you can no longer purchase a cs3 license from adobe.
you can request an activation count reset (Contact Customer Care) and deactivate your cs3 on all your computers. you can then install and activate on up to two computers. -
Stmfadm A host group member cannot be a member of more than one host group
Hello, i setup solaris & make it FC target for my test ESX cluster.
ESXi nodes has not local disk (to boot from), so on solaris side I setup 3 zvol and try to export them to my ESXi host. 1 & 2 zvol to setup ESXi it self & boot from it.
3-d zvol to datastore purposes, store & run virtual machine.
But I have problem with lun masking.
I need following config:
ESXi1 - Lun 1,3
ESXi2 - Lun 2,3
I plan create 3 host-groups:
1 - ESXi1
2 - ESXi2
3 - ESXi1,ESXi2
But it is imposible, it seems there is limit in stmfadm
In manual page I can see: "A host group member cannot be a member of more than one host group."
Can you advice me any solution?
Alex
Edited by: 1009729 on Jun 4, 2013 9:18 PMHello, i setup solaris & make it FC target for my test ESX cluster.
ESXi nodes has not local disk (to boot from), so on solaris side I setup 3 zvol and try to export them to my ESXi host. 1 & 2 zvol to setup ESXi it self & boot from it.
3-d zvol to datastore purposes, store & run virtual machine.
But I have problem with lun masking.
I need following config:
ESXi1 - Lun 1,3
ESXi2 - Lun 2,3
I plan create 3 host-groups:
1 - ESXi1
2 - ESXi2
3 - ESXi1,ESXi2
But it is imposible, it seems there is limit in stmfadm
In manual page I can see: "A host group member cannot be a member of more than one host group."
Can you advice me any solution?
Alex
Edited by: 1009729 on Jun 4, 2013 9:18 PM -
Network or database calls are made when joining more than one table
Hi Friends,
could anybody please let me know how may networks are called when joining more than one table.
Thanks
RinkyHi Rinky,
Normally when a JOIN between two database tables is made then following steps occur:-
1) The control goes to database. Based on the JOINING and WHERE condition, an internal table is created in the DATABASE only which is filled. So here the computation is done at DATABASE level.
2) Once the internal table is filled at database level, it is sent back to the application level.
A Join operation normally minimizes the round trips to the database as most of the computation is done at database level only and results sent back to the Application layer.
<b>Thus for a simple JOIN OPERATION makes a single DATABASE call.</b>
NOTE: If you are satisfied with the explanation, then please reward points
accordingly :).
Thanks and regards,
Ravi . -
Find USERS that are using a particulary Forms ??
It is possibile to find the USERS that are using the a FORMS in application server ??
I must update sometime a forms, but if the user is using the forms it is not possibile. Find the user i can call it for exit from teh form.
Thank's a lot.I'm not aware of such an information somewhere. We had a similar need (actually we needed something more), and we used DBMS_APPLICATION_INFO package, which updates CLIENT_INFO column in V$SESSION.
Bad news are : you have to change every Form to do that....but it's not difficult, you can add a call to that package in WHEN-NEW-FORM-INSTANCE trigger in each Form... -
Finder that returns Collection complains about more than one row
Hi all,
I have a finder method in my local home with this signature:
public java.util.Collection findByManufacturer (String manufacturer) throws
FinderException;
and am getting this error:
javax.ejb.FinderException: finder/ejbSelect 'findByManufacturer'has returned
more than one value. We were expecting only ONE value. See EJB Spec
10.5.6.1, 10.5.7.1
from what i understand, shouldn't the finder allow multiple rows to be
returned? i looked up the EJB spec and that portion seems to address
single-object finders.
system info is as follows:
java weblogic.Admin VERSION
WebLogic Server 6.1 SP2 12/18/2001 11:13:46 #154529
WebLogic XML Module 6.1 SP2 12/18/2001 11:28:02 #154529
thanks,
-saadyes, just to verify i just did a complete re-assembly ( compile beans ; jar
; weblogic.ejbc ; move to domain\config\applications\application ) and am
still getting the same error as before.
furthermore, i dont know about wl internals at all, but it seems that the
container does recognize that this is a collection since the stacktrace
reveals a call to
weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.collectionFinder() ...
the stack trace in question is pasted below. thanks for any help.
-saad
<Feb 19, 2002 9:49:14 PM CST> <Error> <HTTP>
<[WebAppServletContext(595826,catal
og,/catalog)] Root cause of ServletException
javax.ejb.FinderException: finder/ejbSelect 'findByManufacturer'has returned
mor
e than one value. We were expecting only ONE value. See EJB Spec 10.5.6.1,
10.
5.7.1
at
com.metavonni.platinum.catalog.item.PhoneBean_g458gu__WebLogic_CMP_RD
BMS.ejbFindByManufacturer(PhoneBean_g458gu__WebLogic_CMP_RDBMS.java:1297)
at java.lang.reflect.Method.invoke(Native Method)
at
weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.collectionFinder(RDB
MSPersistenceManager.java:274)
at
weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityM
anager.java:669)
at
weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityM
anager.java:642)
at
weblogic.ejb20.internal.EntityEJBLocalHome.finder(EntityEJBLocalHome.
java:381)
at
com.metavonni.platinum.catalog.item.PhoneBean_g458gu_LocalHomeImpl.fi
ndByManufacturer(PhoneBean_g458gu_LocalHomeImpl.java:184)
at jsp_servlet.__x._jspService(__x.java:102)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
"Rajesh Mirchandani" <[email protected]> wrote in message
news:[email protected]...
This should work. Did you recompile your beans when you upgraded to SP2?
Saad Rehmani wrote:
Hi all,
I have a finder method in my local home with this signature:
public java.util.Collection findByManufacturer (String manufacturer)
throws
FinderException;
and am getting this error:
javax.ejb.FinderException: finder/ejbSelect 'findByManufacturer'hasreturned
more than one value. We were expecting only ONE value. See EJB Spec
10.5.6.1, 10.5.7.1
from what i understand, shouldn't the finder allow multiple rows to be
returned? i looked up the EJB spec and that portion seems to address
single-object finders.
system info is as follows:
java weblogic.Admin VERSION
WebLogic Server 6.1 SP2 12/18/2001 11:13:46 #154529
WebLogic XML Module 6.1 SP2 12/18/2001 11:28:02 #154529
thanks,
-saad--
Rajesh Mirchandani
Developer Relations Engineer
BEA Support -
As I start up firefox, I'm prompted to update but it fails saying that it cannot update and that I should make sure that there is not more than one version of firefox running
It was not directly useful, although interesting. It convinced me that there was a problem in android, so I reset to factory defaults and reinstalled Aurora. Now sync is working well again. thanks
-
Hi,
I have just bought formscentral and need advice to achieve my objectives:
Required:
Customer can part fill form, save and complete later on and submit for us to capture the data.
Customer can save or can access their completed form, as we need them to print it out, and physically sign a version for us for legal reasons
Several different people within the customer's business need to fill out different areas of the form, so they may need to e-mail the form bwtween each other or each logon and complete their section.
Are the above achievable? If so can I do as a web form or pdf? Are there any settings I need to apply to the form before or during creation? Are there only certain methods of distribution that will work?
Other concerns:
Our end customers are small traders that are not that computer literate and I worry that they won't have the latest adobe reader or the form won't be compatible with their Mac or firewalls etc and will struggle to be able to fill out, save and submit the forms for technical reasons. Are these concerns justified? If so, are there ways to minimise these issues?
Any guidance is much appreciated. The package also mentions it includes one to one support from Adobe - how do I access this support?
Thank you,
RobIf a requirement is that the form be passed around to several users, I think that the PDF option is your only hope. It will indeed be a problem if users don't have Reader or some other forms-capable PDF viewer. You don't have to do anything special apart from enabling it with FormsCentral. This allows users with Reader versions prior to 11 to save the filled-in form. You'll just have to try to educate the users to use Reader (and NOT to use Preview on a Mac).
-
A new problem with CS5 forced me to download PScc but the problem is still there. I am getting tmp00000001 in photo merge when importing multiple files from inside PS and if trying from bridge I am getting a pop up box telling me I need to select more than 1 file. Photoshop potomerge is not recognizing my selections from bridge..!! please help.. my knowledge of computers is a 3 on a scale of 1-10
if i run this particular code
( SELECT
AccountDetails.CUSTOMERNUMBER, AccountDetails.ACCOUNTNUMBER, CUSTOMERDETAILS.CDTITLE, CUSTOMERDETAILS.CDFIRSTNAME, CUSTOMERDETAILS.CDLASTNAME, AccountDetails.ACCOUNTTYPE,
AccountDetails.ORIGINALCONTRACTENDDATE, AccountDetails.CONTRACTTERM, AccountDetails.CONTRACTENDDATE, AccountDetails.BRANCHAREA, AccountDetails.PRODUCTTYPE,
AccountDetails.HOUSEBANKACCOUNT, AccountDetails.CARMODEL, AccountDetails.CARLICENCE, AccountDetails.ARREARSBALANCE, AccountDetails.CODEBTOR, AccountDetails.GUARANTORNUMBER
FROM AccountDetails
JOIN CUSTOMERDETAILS ON AccountDetails.CUSTOMERNUMBER = CUSTOMERDETAILS.CUSTOMERS1
WHERE EXISTS
( SELECT *
FROM Dcaaccountallocation
JOIN DebtEpisodes ON DebtEpisodes.ACCOUNTID = Dcaaccountallocation.ACCOUNTID
WHERE Dcaaccountallocation.dcaid = 41
AND Dcaaccountallocation.status = 2
AND DebtEpisodes.DCASentDate IS NULL
AND Dcaaccountallocation.ACCOUNTID = AccountDetails.ACCOUNTNUMBER
AND DebtEpisodes.DCAORLAWYER = 'DCA'
This returns 1 row of data
However if i run a small part of the above code...
SELECT *
FROM Dcaaccountallocation
JOIN DebtEpisodes ON DebtEpisodes.ACCOUNTID = Dcaaccountallocation.ACCOUNTID
WHERE Dcaaccountallocation.dcaid = 41
AND Dcaaccountallocation.status = 2
It returns a lot of rows with a status of 2
Now i presume what I am going to do is to ensure that all the fields provide satisfactory requirements, with regards to the above code. Although I have many records in all the stated tables already.
:( -
Where did i find users that are marked for deletion ?
Hi,
Experts,
As i want to check that the users present in table USR02 are marked for deletion or not? can u please suggest me soon on this.
Thank u in advance,
Shabeer AhmedDeleted users list in SRM server
-
New Mac user: Is it possible to move more than one file at a time on a Mac?
I'm a new Mac user. Something so simple in Windows doesn't seem possible in Mac OS and AppleCare doesn't have a clue either. I have edited video files as well as the master footage video file in individual folders created by FCP. I need to transfer 6 video files, 20GB each, onto an external hard drive. This will need to run overnight because I'm using an external HD with only USB and it will take 10 hours or so. How do I transfer these 6 files all at once?
Note: The 6 files are in 6 different folders. I can't transfer the entire 6 folders because they contain other video files in them that I don't need to transfer and are larger than my 20 GB edited files. And last, I shouldn't have to drag these files individually to a folder on the desktop first, because that will take an hour and is a waste of time because I would have to sit there and wait for each to finish.As a new Mac user, you might find the following sites helpful:
Mac 101
and since you're coming from using Windows:
Switch 101
and an independent site many people find helpful:
My First Mac
Regards.
Maybe you are looking for
-
Insert new rows based on user selection on a table display on the screen
Hi.. In my requirement i need to display the line items of a PO# to the user on the screen for specific fields. Each row should also include an additonal checkbox when displayed for the user. When the user checks this check box or clicks on it a new
-
Cannot partition nor erase new SSD hard drive
hi. After my hard drive failed I replaced it with a new SSD. after going into Internet recovery, however, the options to partition or erase the new drive in disc utility are grayed out. Any ideas? Thank you.
-
HT4484 How can i change my country store if i moved to Other country
How can i change my App Store if i moved from spain to Colombia and now i can aupdate my apps Thanks
-
Is there any way to generate pdf from an xml file using single java class
i m working on generating a pdf file from an xml file. i want to use only a single java class to do so. if theres any such code available please help me to find out. Thanks Gurpreet Singh
-
Compressor crashes when opened from fcp
Hi there, Im wondering if anyone can help solve this prob as yet tech support hasn't been able to. When I try exporting using compressor from fcp both programs stop responding and I have to force quit them both. Exporting an qt movie or any other qui