How to determine an object is in an OU based on its DistinguishedName attribute

Hello,
Im trying to ensure all group objects are in a particular OU and if they are, then I will remove them.  All I have is a CSV input file of group names by SamAccountName, so I then do a Get-ADGroup to get the DistinguishedName attribute, but
want to make sure they are in a specific OU, called OU=Test Training Groups, before I remove them.  Any help is appreciated.  Below is what I have so far:
$TrainGroups = Import-Csv C:\Users\Admin\TriningGroups.Csv
Foreach ($Group in $TrainGroups) {
Get-ADGroup $Group | Select DistinguishedName
So what would be the best way to read the results of the Get-ADGroup query and determine the group is in the OU=Test Training Groups?
Thanks for your help! SdeDot

Hi,
Assuming the header of your CSV file is SamAccountName, this is how I'd do something like that:
Import-Csv .\groups.csv | ForEach {
$groupName = $_.SamAccountName
try {
$group = Get-ADGroup -Identity $groupName
If ($group.DistinguishedName -like '*,OU=Test Training Groups,*') {
Write-Output "$groupName is in the correct OU"
} Else {
Write-Output "$groupName is NOT in the correct OU"
} catch {
Write-Warning "Group not found: $groupName"
Don't retire TechNet! -
(Don't give up yet - 12,950+ strong and growing)

Similar Messages

  • How to determine the object in the tablespace

    Hi
    I have a problem with my database, How can i determine the object in the tablespace
    and how do move old tablespace into new tablespace and how to drop existing tablespace.
    Thanks

    Hi,
    If you want to find for all objects information, you can use dba_segments and filter this against the tablespace name. Once done you can create another tablespace and move the objects from old tablespace to new tablespace. Later you can drop the old tablepspace. You can use the below mention commands also:
    SELECT 'ALTER TABLE '|| table_name ||' MOVE TABLESPACE USERS;'
    FROM user_tables WHERE tablespace_name='MY_TableSpace';
    SELECT 'ALTER INDEX '|| index_name ||' REBUILD TABLESPACE USERS;'
    FROM user_indexes WHERE tablespace_name='MY_TableSpace';
    SELECT 'ALTER TABLE '|| table_name ||' MOVE LOB ('
    || column_name ||') STORE AS (TABLESPACE USERS);'
    FROM user_lobs WHERE tablespace_name='MY_TableSpace';
    On the other hand,
    You can also export a backup of the source tablespace and import into the target tablespace.
    Regards,
    XIC

  • How to determine which object was change within a snapshot

    Dear All,
    We are using OWB 9.2.0.4 with Oracle database 9.2.0.7.
    I have taken a full snapshot of an OWB project that includes several modules(cascade). I one of the modules I have created a new table, and added it to an existing mapping in that module.
    When I compare the module with the snapshot I took before, I get that all modules have changed and all thier mappings. When drilling down I can see that for the objects I did not change only an internal property was changed.
    How can I determine what has changed? Do I have to drill down on all objects?
    Regards
    Galit

    Hi,
    We are using 10.2.0.4.36 for the client and 10.2.0.4.0 enterprise edition for the database.(info from the session props window)
    rgrds Mike

  • How to determine the object type?

    Hi,
    I got a method that is of the following signature:
    Object result = method.invoke(object,args);The result can be any type from primitive types like double to class type.
    How can I determine whether the result object is of what type?
    I am thinking of using
    (if result instanceof Double)
          //do something
    }However, the method call invoke can return a primitive type double, so will the above method
    (if result instanceodf Double) be called?
    Thanks.

    However, the method call invoke can return a primitive
    type double, so will the above method
    (if result instanceodf Double) be called?(result instanceof Double) will be true because quoting the javadocs for Method.invoke(): "if the value has a primitive type, it is first appropriately wrapped in an object."
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/reflect/Method.html#invoke(java.lang.Object,%20java.lang.Object[])

  • How to determine deleted objects in a transport

    Hi
    I create a new report Z_TEST_1 and assign this one to a new transport request.
    Now I rename this report to Z_TEST_1B
    In my transport are two entries:
    -Z_TEST_1
    -Z_TEST_2
    Now I read this objects with function module TR_READ_COMM
    Afterwards I want to analyse the objects of this transport
    But how can I see which objects exists and which not?
    I only need the (still) existing objects (in my test case: Z_TEST_2)
    I don't want to check every single object if this object still exists. I know I could check the entry in table TRDIR (for reports).
    But there are a lot more object kinds in my transport (function modules, dictionary objects, forms, table keys)....
    Does anyone have a simple solution for this problem?
    Thanks
    Andy

    Hello There.
    SE03 is for finding the existing objects according to your first question (for function modules, reports, etc).
    As your object is not imported or transported.
    You need to find your deleted objects in Transaction SE95.
    In the window beneath,
    1. Go to window, Reset Objects.
    2. Check the deleted objects.
    3. You can also mention your request or package.
    4. Execute.
    5. Go to Deleted objects node.
    6. Navigate to the node desired.
    7. You can also find the request related to that business object by clicking on find requests.
    These are the logs.
    If you have already tried out then its good or else give feedback.
    Good Luck & Regards.
    Harsh Dave

  • How to change the chart color in report 6i based on its value?

    I built a simple chart using Chart Wizard in Report 6i, with X axis = supplier and Y axis = rating. I want the chart to show different color for certain rating, eg: above 80% => red color.
    Anyone know how to do this?
    Pls help!

    Hi Resham,
    In SP list, you change the background color of field value using Content editor and javascript.
    Add the content editor webpart on the list page with javascript which highlight the particualr value based on the condition.
    You can refer to following link
    http://blog.pathtosharepoint.com/2009/02/26/highlight-rows-in-sharepoint-lists/
    Thanks,
    Vivek
    Please vote or mark your question answered, if my reply helps you

  • How to determine the proper size for Oracle 8i Data Base Objects

    Hi,
    I'm working on an Oracle 8i Data base. I'd like to know how to determine the proper size for the Data Base objects such as tables, datafiles, tablespaces...
    Thanks.

    Start with the docs.
    http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a76956/schema.htm#949
    Best Regards
    Krystian Zieja / mob

  • EEWB :  how to determine the business object and the extension type ?

    Hi,
    I ask myself how to determine the business object and the extension type to use to add new fields in a new tab of a specific transaction ? what means each business object, does that correspond to a specific transaction ?
    I need to add a new tab in the ‘BaMI’ business activity in transaction CRMD_ORDER just after the tab 'Actions' at header level.
    Could you help me please to determine which business object and extension type I have to select during creation of the project and which business object category I have to select during creation of the extension (wizard) ?
    Thanks for your help,
    Marie

    Marie,
    In order to determine what type of transaction you are extending, you will need to look at the customizing for the transaction.
    In the IMG:
    Goto:
    Customer Relationship Management->Transactions->Basic Settings->Define Transaction Types.
    You will then choose the transaction defined that you want to extend.  If you display the details of the transaction you will find an attribute called:
    "Leading Transaction Category".  This tells you the general context in which the transaction is used.  The other item to view is the assignment of business transaction categories found in the maintenance screen.
    This information general corresponds to one of the options that the EEWB will give you on the transaction type.
    As far as extensions go, my recommendation is the following:
    - Use CUSTOMER_H Customer Header Extensions for any new fields at the header level.
    - Use CUSTOMER_I Customer Item Extensions for any new fields at the item level.
    Unless you have a specific requirement to extend a segment of the transaction, I recommend placing all new fields in these segments.  The CUSTOMER_H & CUSTOMER_I segments are considered "standard" segments, that are already built into all the necessary API structures. 
    Let me know if you have any further questions.
    Good luck,
    Stephen

  • How to determine a View Object Type (read only or Updatable) ADF B.C 10.1.3

    Hi all,
    in scott Schema by ADF B.C 10.1.3, I created an entity object like emp
    and created view object EmpView from emp and dept entities
    and Application Module
    and when draging EmpView and dropping it in jspx
    while running I got an error :
    JB0-25003 your EmpView View Object has no Type
    How to determine a View Object Type (read only or updatable) in B.C ?
    Thanks

    Hi,
    this should not require any manual confiuration. Can you select the ApplicationModule in the model, right click on it and run the ADf BC tester ? Check if he ViewObject runs if not added to JSF
    Frank

  • Determine all objects that a group has been assigned to

    I am trying to determine all objects that a group has been assigned to. For example, I would like to know what communities and portletes a group has been assigned to.
    I can retrieve the information directly from the plumtree database, however, I have not been able to determine how to accomplish this via the api.
    I have tried the following
    IPTObjectManager ptObjMng = ptSession.GetCommunities();
    for(inti = 0; i<3;i++)
    filter[i] = newObject[1];
    filter[0][0] = PT_PROPIDS.PT_PROPID_USERGROUP_GROUPID;
    filter[1][0] = PT_FILTEROPS.PT_FILTEROP_EQ;
    filter[2][0] = 1634; //group id for my group
    IPTQueryResult ptResult = ptObjMng.Query(PT_PROPIDS.PT_PROPID_ALL,-1,PT_PROPIDS.PT_PROPID_NAME,0,-1,filter);
    I have verified that the group has been assigned to the community, however, this query returns no records.
    How can I retrieve all communities or group that a specific group has been assigned too?
    thanks in advance

    This sure would be a handy feature! iTunes has it so that you can easily tell which playlists a song is in. It would be convenient for iPhoto as well.

  • How to determine the structure of parameter method in WebServiceDataControl

    Hi all ,
    I have a web Service Data Control ,this data control has web service method that take a parameter of type (java.lang.Object)
    how can I determine the structure of this object to send it to the web service method
    (how can create the object that satisfy the object parameter of web service data control)

    I can see the constructor of data control which contain (name,age)
    but I don't know how can I send these two parameter in one object that satisfy the type of object in the web service method
    "parameterObject" : contain (name and age) values . (I don't know the type of "parameterObject" in web service)
    Map params = operationBinding.getParamsMap();
    params.put("arg0", parameterObject);

  • How to determine the Docid

    I would like to open a web intelligence detail report I created from within an xcelsius dashboard.
    However, I can't use the FS command button or URL buton, because I don't know how to determine what the document id for the webi report is.  I've gotton lost wandering around the business objects website.  Since our company is new to BOBJ, no one on the project team is quite sure how to do this either.
    Can anyone point me in the right direction.  I'm not a .net  or web services developer.  I just create universes, webi reports and dashboards.
    Thanks.

    I can provide you with this tip:
    To obtain the document ID, navigate to the document in InfoView, hover your mouse over the document name hyperlink, and look for the ID number in the browser's status bar. You can also obtain the document ID from the Central Management Console.

  • How to determine the field size

    I am going to make a multiplatform application that hopefully
    will run on linux and windows 2000.If the os is 2000, then I will use
    vb.net/aspx else I'll use java servlets. I make the connection
    to the web server ( through HTTP) not directly to database server.
    So, the resultset will be stored in the String object. The columns
    will be separated by delimeter. Our problem is how to determine
    the size and type of the fields of mssql,oracle and postgres database
    so that we can include it in the String object.
    Ex.
    String sResultSet=new String();
    ResultSet rs=statement.executeQuery(sSQL);
    while(rs.next()){
    sResultset=sResultSet + rs.getString(field1) + "||" + rs.getString(field2) + "||";
    vertical bars acts as delimeter
    supposedly this is the code:
    sResultset=sResultSet + rs.getString(field1) +"_" + rs.getFieldType() + "_"+
    rs.getFieldSize() + "||" + rs.getString(field2) +"_" + rs.getFieldType() + "_"+
    rs.getFieldSize() + "||";
    supposedly this is the code if rs.getFieldType() and rs.getFieldSize() methods are existing
    Anyone can give me an idea how to get the field type and field size of the database?
    thanks in advance

    Yes, but I dont know how to do it.
    Can you give me an example of using it.
    Thanks in advance

  • How to determine the type of the jobject... similar to instanceof

    hi,
    I would like to know how to determine the jobject reference of an instance is of which class.
    this is something similar to instanceof we use in java.
    is there any thing like 'instanceof' in JNI. if there how to use it?
    i got this as objective question for which answers were(i do not remember exactly)
    1.instanceof
    2.assignedto
    i could nt het much help in googling.
    thanks in advance

    Hi
    The JNI provides a native version to the java instanceof operator, this function takes two arguments
    an object refrence and a class refrence and reports JNI_TRUE.
    jclass myclass = env->FindClass("your class name");
    if(env->IsInstanceOf(obj,myclass) == JNI_TRUE)
    // obj is of type myclass
    }Regards
    pradish

  • How to determine the solution's ID in absl?

    Hello Community,
    I have a simple question yet I fear there is no simple answer (possibly no answer at all).
    The question is:
    Does any body know ways how to determine the ID (e.g. Y123ABCDY_) of the solution the code is running in?
    My use case is the following:
    We have a solution template which will be deployed in different customer tenant.
    Thus, each deployment will have a different solution ID.
    Now, somewhere in code, we generat PDFs using the OutputManagementUtilities.GetPDF reuse library.
    This method requires the form template code of the pdf to be generated as a parameter.
    However, this PDF form template code is composed of the solution ID and a fixed suffix.
    Thus, currently I need to modify the absl code in each customer installation to manually modify the form template code prefix to the solutions solution ID.
    Therefore I'd like to construct the form template code in absl but for this I need a way to determine the solution's ID.
    Any ideas?
    Best regards,
    Ludger

    Hi Fernando.
    After reading your post I initially thought "what is the ObjectTypeCode" supposed to do any good to determine the solution ID"?
    Using the Object Type code of a custom bo is indeed a way to solve this problem.
    With a little additional code I can extract the relevant solution ID part from there.
    Thanks for the hint, that was really useful.
    Best reegards,
    Ludger

Maybe you are looking for