SQL Script - PO/PR Approval Groups and associated Positions and holders

Hi,
Does any one has SQL to list down - PO/PR Approval Groups and associated Positions and holders?
Rgds

If you are looking for verifiing the approval groups, you can use the approval diagnostics; that has most of these sqls.

Similar Messages

  • Emailing PO script to both Purchasing Group and Vendor

    Hello All,
    Is there a way to email PO SAP script to both Purchasing Group and Vendor?
    i searched the form and endup with no luck.
    Regards,
    Sree

    Hi
    in the print program  the funciton module which you used for sending the mail add the email id of vendor and purhcasing group to the receiver list and it will send to both the parties
    regards
    m.a

  • SQL Script working differently with 8i and 9i

    Hi
    I am facing strange problem with my simple SQL script called from a shell script. It bahaves differently with ORACLE 8.1.7.4 and 9.2.0.1. The machine is same.
    sqlplus -s / @Tech.sql WKC625 11 11 '11 22' ""
    This is working with 9i but it does't work with ORACLE 8.
    Actually what happens is that the argument in single quotes (') is taken as 2 separate argument.
    The Tech.sql is :
    spool add
    insert into TECH values ('&1','&2','&3','&4','&5','');
    commit;
    quit
    I tried putting double quotes also. Is something got changes between ORACLE 8 and 9i.
    Please help
    Surendra

    Are you sure it works in 9?
    If you are using UNIX, then the O/S will strip the quotes while processing the arguments. You need to use 2 single quotes around 11 22, just as you have around the empty string at the end.
    I believe that Windows does the same, but I do not use windows.
    John

  • How to load SQL scripts from a text file.

    Hi, i tried several time to load a text file/SQL script with 10 different tables and data, but 10g Express doesen't allows me to do that, any one can direct me or point out to me what i should do or do i need to adopt any special method to to get this done. i am sure there must be some thing where you can upload SQL scripts from a text file (in SQL command editor!). thanks

    Hi,
    see my other answer here:
    SQL command editor doesn't take more than 1 insert command
    This seems to be a duplicate question, right? Or am I missing something?
    Regards,
    ~Dietmar.

  • How to use parameters in oracle SQL script????

    Right now I am writing a SQL script to create a schema and build the objects of this schema....
    I use a .net winform program to run sqlplus to parse this sql script ...
    The problem is that the schema name and the tablespace's location and the sys password must be input by the user, so my SQL script should use these runtime input parameters instead of const parameters....
    So, how to use parameter in SQL script ...........
    Are there some example scripts in oracle home directory for me to refer to????

    Hi,
    UNISTD wrote:
    thanks .....
    what's the difference between variable , define, accept in sqlplus ???VARIABLE declares (but does not assign a value to) a bind variable. Unlike substitution variables, bind variables are passed to the back end to be compiled, and they can only be values in certain data types. You can not use a bind vaiable in place of an identifier, so to do something like
    CREATE USER  &1 ...a bind variable won't work.
    "DEFINE x = y" sets the substitution variable &x to have the value y. There is no user interaction (unless x or y happen to contain undefined substtiution variables).
    "DEFINE x" shiows the value of the substitution variable &x, or, if it is undefined, raises a SQL*Plus error. I use this feature below.
    ACCEPT sets a substitution variable with user interaction.
    And if the user miss some parameters in “sqlplus /nolog ssss.sql par1 par2 par5 par6”, how to use default value of the miss parameters??Don't you need a @ befiore the script name, e.g.
    sqlplus /nolog @ssss.sql par1 par2 par5 par6Sorry, I don't know of any good way to use default values.
    The foloowing works, but, as you can see, it's ugly.
    "DEFINE 1" display a message like
    DEFINE 1            = "par1" (CHAR)if &1 is defined; otherwise,it will display a SQL*Plus error message like
    SP2-035: symbol 1 is UNDEFINEDNotice that the former contains an '=' sign, but the latter does not.
    The best way I know to use default values is to run the DEFINE command, save the output to a filee, read the file, and see if it's an error message or not.
    So you can use a script like this:
    --     This is  DEFINE_DEFAULT.SQL
    SPOOL     got_define_txt.sql
    DEFINE     &dd_old
    SPOOL     OFF
    COLUMN     dd_new_col     NEW_VALUE     &dd_new
    WITH     got_define_txt     AS
         SELECT  q'[
              @got_define_txt
    ]'               AS define_txt
         FROM    dual
    SELECT     CASE
             WHEN  define_txt LIKE '%=%'
             THEN  REGEXP_REPLACE ( define_txt
                               , '.+"
    ([^"]*)
                         , '\1'
             ELSE  '&dd_default'
         END        AS dd_new_col
    FROM     got_define_txt
    {code}
    and start your real script, ssss.sql, something like this:
    {code}
    DEFINE          dd_new     = sv1
    DEFINE          dd_old     = 1
    DEFINE          dd_default     = FOO
    @DEFINE_DEFAULT
    DEFINE          dd_new     = sv2
    DEFINE          dd_old     = 2
    DEFINE          dd_default     = "Testing spaces in value"
    @DEFINE_DEFAULT
    {code}
    when this finishes running, the substitution variable &sv1 will either have the value you passed in &1 or, if you didn't pass anything, the default value you specified, that is FOO.
    Likewise, &sw2 will have the value you passed, or, if you didn't pass anything, the 23-character string 'Testing spaces in value'.
    Here's how it works:
    Define_default.sql puts the output of the "DEFINE x" command into a column, define_txt, in a query.  That query displays either the existing value of the substitution variable indicated by &dd_old or, if it is undefined, the default value you want to use, which is stored in the substitution variable &dd_default.  The substitution variable named in &dd_new is always set to something, but that something may be its existing value.
    Notice that the paramerters to define_default.sql must be passed as global varibales.
    Why didn't I just use arguments, so that we could simply say:
    {code}
    @DEFINE_DEFAULT  sv1  1  FOO
    {code}
    ?  Because that would set the substitution variables &1, &2 and &3, which are miost likely the very ones in which you're interested.
    I repeat: there must be a better way, but I'm sorry, I don't know what it is.
    I usually don't do the method above.  Instead, I always pass the required number of parameters, but I pass dummy or plce-holder values.
    For example, if I wanted to call ssss.sql, but use defulat vlaues for &1 and &3, then I would say something like:
    {code}
    @ssss  ?  par2  ?
    {code}
    and, inside ssss.sql, test to see if the values are the place holder '?', and, if so, replace them with some real default value.  The use has  to remember what the special place holder-value is, but does not need to know anything more, and only ssss.sql itself needs to change if the default values change.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • SQL Script in XE Cancels during Execution without returning any error(s)

    Hi all;
    I'm running a SQL script with a drop table and create table statement along with several hundred insert statements to load data into this table in a Oracle 10g XE database. There's a total of 213 SQL command lines in the script. (1 Drop Tbl/1 Create Tbl/211 Insert(s)).
    I run the script within the Script Editor in the Oracle XE web interface and it processes 45 of 213 of the SQL commands in the script successfully(1 Drop Tbl/1 Create Tbl/43 Insert(s)). Then the Manage Script Results screen shows a status of "Canceled". It doesn't even attempt to insert the other rows and spit back any error messages. I tried debugging by checking the consistency of the insert statements at the break point and couldn't find any discrepancy. The script just stops executing and shows this cancelled status? Can anyone help me figure out why all the lines of this script aren't being executed? I'd appreciate it a lot!
    Thanks.
    -GM

    I've spooled output to a file which I've pasted below in italic pre-tags. I abbreviated some of output to save space in this thread. I didn't want to include 600 rows showing "1 row created" 211 times with 3 spaces between each of them. So here is my abbreviated output:
    SQL> set define off;
    SQL> @\Oracle\UTC_Upload_100807.sql;
    Table tbl_UTC_HPS_Report dropped.
    Table tbl_UTC_HPS_Report created.
    211 rows created.
    SQL> describe tbl_UTC_HPS_Report;
    Name Null? Type
    STATUS VARCHAR2(255)
    CUSTOMER_NAME VARCHAR2(255)
    CUSTOMER_NUMBER VARCHAR2(255)
    LICENSE_DESCRIPTION VARCHAR2(255)
    CONTRACT_DATE VARCHAR2(30)
    CONTRACT_NUMBER VARCHAR2(255)
    QUANTITY NUMBER(5)
    INVOICE_DATE VARCHAR2(30)
    INVOICE_CCY_CODE VARCHAR2(30)
    INVOICE_NUMBER VARCHAR2(255)
    SUPPORT_PROGRAM VARCHAR2(255)
    RENEWAL_START_DATE VARCHAR2(30)
    RENEWAL_END_DATE VARCHAR2(30)
    INVOICE_AMT VARCHAR2(255)
    INSTANCE_NUMBER VARCHAR2(255)
    SQL> select * from tbl_UTC_HPS_Report;
    STATUS
    CUSTOMER_NAME
    CUSTOMER_NUMBER
    LICENSE_DESCRIPTION
    CONTRACT_DATE
    CONTRACT_NUMBER
    QUANTITY INVOICE_DATE INVOICE_CCY_CODE
    INVOICE_NUMBER
    SUPPORT_PROGRAM
    RENEWAL_START_DATE RENEWAL_END_DATE
    INVOICE_AMT
    INSTANCE_NUMBER
    ENTERED
    STATUS
    CUSTOMER_NAME
    CUSTOMER_NUMBER
    LICENSE_DESCRIPTION
    CONTRACT_DATE
    CONTRACT_NUMBER
    QUANTITY INVOICE_DATE INVOICE_CCY_CODE
    INVOICE_NUMBER
    SUPPORT_PROGRAM
    RENEWAL_START_DATE RENEWAL_END_DATE
    INVOICE_AMT
    INSTANCE_NUMBER
    United Technologies Corporation
    STATUS
    CUSTOMER_NAME
    CUSTOMER_NUMBER
    LICENSE_DESCRIPTION
    CONTRACT_DATE
    CONTRACT_NUMBER
    QUANTITY INVOICE_DATE INVOICE_CCY_CODE
    INVOICE_NUMBER
    SUPPORT_PROGRAM
    RENEWAL_START_DATE RENEWAL_END_DATE
    INVOICE_AMT
    INSTANCE_NUMBER
    The last select statement above results in continuous spitting out of column headings with no data. I've truncated it here to save space. When I go through the Oracle Database XE web front end I see that the table was created; however it says "This table has no data". So still no luck. Hope you can help. Thanks.
    -GM

  • How to submit an input dynamically to an sql script in a shell script

    Dear all,
    I have a shell script myscript.sh, in that I am running an sql script , say mysql.sql, the sql script prompts for a value, and I have to type that prompted value to run the script. How can I give this value in my shell script itself.
    Sample script
    #!/bin/bash
    echo "script starting at $(date)"
    sqlplus apps/apps @mysql.sql
    echo "script completed at $(date)"
    exit
    Regards,
    Charan

    Hi,
    Please see
    $cat sql_para.sh
    #!/bin/bash
    . .bash_profile
    sqlplus -s apps/apps @status $1
    $cat status.sql
    select status from v$instance where host_name='&1';
    exit;$./sql_para.sh TEST
    You may also see
    http://www.nsa.no/259/shell-scripting-dbas-using-awk-manipulate-oratab
    https://communities.bmc.com/communities/docs/DOC-9942
    Thanks

  • Sql Script-Update Recepient Reference Password

    Hi All,
                I am very new to Biz-talk server and this is my first task in biz-talk. And I have task to Update Recipient Reference Password in agreements of the parties folder.
               In my Biz-talk Administration console I had the folder with name "Parties" and it holds party name called "NZ" and this NZ is having some agreements. 
               When I click for one of this agreement I am getting 3 taps and in the second tap I am having the column called "Recipient Reference Password" in Identifiers sub-tab in this column I need to write the Sql
    Script command and set the default value as "NZ".Below is the image.
        Can any one help me how can I do this
    Samar

    Not using a SQL script but with C# code and using Microsoft.BizTalk.ExplorerOM can try this..
    The classes which could get you closer are Microsoft.BizTalk.Deployment.Binding.Party and Microsoft.BizTalk.Deployment.IEdiParty. More probably you may have deal with XML and use XPath to update your setting in the XML and then
    Loadthe XML into party settings using EdiData.LoadXml
    Use the following article as the reference to start exploring options..
    http://btserver.blogspot.co.uk/2010/05/exporting-specific-party-from-biztalk.html
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • How to upgrade the schema on both the sites using sql scripts?

    Hi Experts,
    I need some help.
    I have two sites SITE A and SITEB, on both the sites GG is installed and running (DML Bi- directional replication). I have schema SCHEMA1 on both the sites which are configured for replication and replication is working from last one year.
    Now I wanted to upgrade the SCHEMA1 on both the sites. There are three .sql script which has many SQL commands like create table, create sequence, create procedure, insert record etc. I wanted to run that SQL file one both the sites.
    So should I stop all the process on both the sites SITEA and SITE B (including manager process) ,execute the SQL scripts on both the sites and then start the process again ? Will it work?
    Is there any other best way to do this?
    Could you please suggest the steps so that I can successfully execute theses scripts on both the site to upgrade the schema1.

    There is no blanket answer here; it depends. Main questions are:
    1. Do the SQL scripts update existing tables?
    2. Are you replicating DDL in one direction? (DDL should only be replicated one way even when doing bi-directional, do DDL should only be issued on the node capturing DDL
    3. Are you using a wildcard (*) from table names or using an explicit list?
    Easiest thing is if you're replicating DDL from A to B and apply DDL to A only. This assumes that the application writing to these tables can handle DDL changes under the covers. If these are new tables supporting new application features then you would simply enable said features after apply sql files.
    From there it gets more complicated and would need answers to the above questions before going down each line of logic. But try to remember what's really going on here. Data in one form (DDL) is being captured and send along. If the "shape" (DDL) of that data changes then the extract and replicat need to update their meta data to handle it correctly. If change data encounters a different shape than what's cached then you will become out of sync.
    I'm not sure if that makes sense but again, the answers to the questions above will be indicate where more detailed explanations should be focused. In short, we need more detail about what those scripts do and your current setup.
    Good luck,
    -joe

  • Problem saving SQL Scripts

    Has anyone has this problem:
    1) I log onto my database (Oracle XE 10.2.0).
    2) I open a SQL Script that I previously created and saved. The script is about 1700 bytes.
    3) I edit the script. I run the script. I click "Edit Script" button on results screen.
    4) Everything is fine.
    5) I repeat these steps (1-4) 10 or 20 times and then all of a sudden all edits to my script stop saving.
    A) When I run the script without explicitly saving the script, it runs the unedited version of the script.
    B) When I explicitly save the script, the edits do not save.
    C) If I log off the database and back on again, the effects are the same (beginning here with "5)" from the get-go).
    D) I I log off the database, shut down IE 7.0, reboot IE, log back on to the database I begin here at "5)" again.
    E) I mark all my script and copy it to clipboard. I replace script with 3 bytes: "aaa". I click "Save". The three bytes save.
    F) I replace the 3 bytes with my original 1700 bytes of code. The 1700 bytes do not save; only the three bytes remain.
    6) In summary, I would ask, "Is there a size limit to the amount of SQL script you can save using this application?". However, the problem with this question is that everything worked fine for me for one and one-half hours of using the app.
    I will go now to reboot my machine to see if that resolves it.
    I will report back here with the results of that experiment.
    Anybody has any insight, I would be grateful 'cause this is frustrating!!
    Thank you,
    Mike Kemp
    St. Petersburg, FL

    OK problem started right off the bat today.
    But then again the computer had been up and running overnight, multiple users during that time, etc.
    So I rebooted.
    Script is up to 2120 bytes now.
    Problem was not resoved by reboot.
    No matter what I do I can't edit my script and have it save (I edit it, copy and paste to Notepad and move back and forth as needed ... however problem is that when I click "Run" it never recognizes the new script; it always runs the old one).
    Let me take my 2120-byte script and paste it into a brand-new Script Editor window and see if it will run from there (thinking that maybe this Apex thing just can't run long scripts at all)....
    OK that works!!
    Hmmmm...so looks to me like Apex Script Editor can't edit long scripts (I started running into problems when my script exceeded 1700 bytes).
    I'll keep posting back here in case somebody big in Oracle Apex World (I just heard Tom Kyte talking about the guy who created Apex ... can't remember his name now) cares.
    I know, I know they'll probably tell me it's user error :-)
    -Mike

  • Importing HTMLDB application through sql scripts

    I have a question regarding importing application in HTML DB. We have developed an application in one of our instances and now we would like
    to deploy the same in all other instances (around 180 instances). We will copy the schema objects through export / import from the backend (through a script). But to import the application, we need to logon to htmldb (from frontend ) and import it.
    As we have to do it across 180 instances, its very difficult to do it after login to htmldb and import the application. We would like to know if we can import an application and workspace by running the sql scripts ( created by exporting application and workspace on source instance) in the sqlplus prompt.
    In this regard could any one please let me know about the following things.
    1. Can we directly run the sql's (which were created when we exported workspace and application) in the target database?.
    2. If yes, from which user we should run this sql script (Presently we are using HTMLDB 2.0 version)
    I have also noticed the following schemas are locked in the database.
    FLOWS_020000
    FLOWS_FILES
    FLOWS_010500
    3. Are there any extra steps which we need to do it after running the sql scripts in target instance.
    4. Is there any way to delete the application and workspace from backend (i.e sqlplus) incase if we need to re-import the same application and workspace.
    (This situation arises if we need to make any changes to the application after deploying it in the data center.)
    Your help in this regard is highly appreciated.
    Thanks in advance.
    Suneel

    if we can import an application and workspace by running the sql scripts ( created by exporting application and workspace on source instance) in the sqlplus prompt
    Yes, you can.
    1. Yes.
    2. The workspace export files need to be run as the FLOWS_nnnnnn schema (depending on which version of HTML DB is the active one, you seem to have both 1.5 and 2.0 installed). Yes, you would need to unlock the account first to do this.
    3. If your application needs external CSS or Javascript or image files, you need to copy those over using standard OS file copy tools
    4. Importing a application using SQL*Plus deletes the existing application first so you are fine. You would never need to delete a workspace, a workspace is just a "shell", a container for all your applications.
    Hope this helps.

  • Error 45 Initializing In SQL*Plus When Running A Sql Script

    Hi All
    I have a daily scheduled jobs running on Windows server 2003 and 2008. Oracle Version :10.2.0.1 and 10.2.0.4
    right now jobs are not even starting when i run them manually. Found the error Error 45 Initializing In SQL*Plus When Running A Sql Script.
    it says Bug:3039738.
    what is the solution to fix this Bug ?
    thanks
    Shawn

    user9174724 wrote:
    Hi
    do you think the Problem is not with the script ?
    when i run the job its reaching SQLPLUS and giving error
    Error 45 Initializing In SQL*Plus When Running A Sql Script .
    Server:windows 2003 and oracle version :10.2.0.1
    CMD /C %ORACLE_HOME_PRIME%\bin\sqlplus.exe /NOLOG @ %xxxx_HOME%\DBA_Backup\BackupDo.sql testdb BackupFull
    The above line does the following:
    1) launches a command procesor
    2) passes that command processor the following command line parms:
    /C
    (process the following command, then terminate)
    %ORACLE_HOME_PRIME%\bin\sqlplus.exe
    the launched processor will process the executable 'sqlplus.exe' found in the \bin subdirectory, found in the directory indicated by the environment variable ' ORACLE_HOME_PRIME'. The remainder of the command line will be passed to sqlplus.exe for interpretation and processing
    /NOLOG
    tell sqlplus to start up without trying to immediately log on to a database
    typically used to indicate to sqlplus that the immediately following string names a file of sql and sqlplus commands to be processed.
    %xxxx_HOME%\DBA_Backup\BackupDo.sql
    tell sqlplus to execute the commands found in the file 'BackupDo.sql', found in the subdirectory DBA_Backup, found in the directory name by the environment variable 'xxxx_HOME'.
    testdb
    BackupFull
    pass the values 'testdb' and 'BackupFull' to be used as values for substitution variables &1 and &2 in the file 'BackupDo.sql'
    Script:
    rmanbackup.rman
    BACKUP AS COMPRESSED BACKUPSET DATABASE FORCE PLUS ARCHIVELOG;
    DELETE NOPROMPT ARCHIVELOG ALL BACKED UP 2 TIMES TO DEVICE TYPE DISK;
    LIST BACKUP SUMMARY;
    LIST BACKUP;
    EXIT;I don't know what you expect of this. It is an rman script and we've seen no sign of an rman script being executed in any of what you've shown us. RMAN commands are processed by rman, not sqlplus.
    Unfortunately, you didn't think showing us the contents of BackupDo.sql was of any value in finding out what your problem was.
    Edited by: EdStevens on Jul 11, 2011 7:58 PM

  • AME Approval Group is FND USER, but it is giving error

    Hi,
    I have developed an AME Rule, it is a pretty simple rule , and has one of the approval Group which is static and has FND User as the approval type.
    The approval group and the rules are created , but as the user submits a transaction , they receive an error "AME Approval list could not be generated, please contact your System Admin". As soon as we remove the static Approval group (FND USER based group) the transaction is submitted successfully and the AME approval list is also generated.
    The FND user , we are using in this scenario is not an HR User, but is a valid User Account.
    Am I missing something , please any help will be appreciated.
    Instance details :
    Application Version 12.1.2
    DB 11.0.3

    Approvals Management Business Analyst Dash Board,
    Select your Transaction Type --> Click on the Approval Group --> Create New Group
    Name XXX
    * Description XXX
    * Order Number : 1
    Voting Method : Serial
    Usage Type Static
    Approver Type :
    Add another Row
    fnd_user --> Select the user , click on apply.
    Attach this approval group to your rule
    Hope this helps.
    Thanks,
    Ranga

  • SQL Query to get All AD Groups and its users in Active Directory

    Hi,
       Is there any query to get all AD groups and its user in an instance of a SQL server?

    Check this blog.
    http://www.mikefal.net/2011/04/18/monday-scripts-%E2%80%93-xp_logininfo/
    It will give you more than what is required. If you dont want the extra information,then you can try this.. I took the query and removed the bits that you might not require.
    declare @winlogins table
    (acct_name sysname,
    acct_type varchar(10),
    act_priv varchar(10),
    login_name sysname,
    perm_path sysname)
    declare @group sysname
    declare recscan cursor for
    select name from sys.server_principals
    where type = 'G' and name not like 'NT%'
    open recscan
    fetch next from recscan into @group
    while @@FETCH_STATUS = 0
    begin
    insert into @winlogins
    exec xp_logininfo @group,'members'
    fetch next from recscan into @group
    end
    close recscan
    deallocate recscan
    select
    u.name,
    u.type_desc,
    wl.login_name,
    wl.acct_type
    from sys.server_principals u
    inner join @winlogins wl on u.name = wl.perm_path
    where u.type = 'G'
    order by u.name,wl.login_name
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com

  • Ideal way to report on Nested Groups and their Members - I can get the script to work if there's one group, but not if there is two or more

    Hi All,
    I like to keep track of Groups and Users added into our Domain Admins.  Yes, it should always be minimal, but if I can have a daily report just to be certain, I'll sleep better.
    The following works just fine if there is a single nested group.  I cannot get it to work properly if there is more than one.  I'm hoping you'll see what I'm missing.
    Works fine:
    $admins = get-adgroupmember "domain admins"
    foreach($i in $admins){if($i.objectClass -eq "group"){ get-adgroupmember $i.samaccountname |foreach {New-Object PSObject -Property @{ username = $_.name;Group = $($i.name)}} | select username,group | export-csv c:\Users_and_Groups.csv -Notypeinformation}}
    Does not work well.  Result is that the "Group" information doesn't change to the correct group:
    $myCol=@()
    foreach($admin in $admins){if($admin.objectClass -eq "group"){$myCol+=$admin.samaccountname}{foreach($i in $myCol){get-adgroupmember $i | foreach {New-Object PSObject -Property @{ username = $_.name;Group = $($admin.name)}} | select username,group
    | export-csv c:\Users_and_Groups.csv -Notypeinformation}}}
    Here is what I have in $myCol:
    PS C:\Users\Administrator> $myCol
    MarketingPSO
    RMSysAdmins
    I tried shortening up the one-liner a bit more, but for some reason the "RMSysAdmins" is the only Group listed even though Leia and Han are in the MarketingPSO Group:
    foreach($i in $myCol){get-adgroupmember $i | foreach {New-Object PSObject -Property @{ username = $_.name;Group = $($admin.name)}} | select username,group }
    username                                                   
    Group                                                     
    Leia Organa                                                
    RMSysAdmins                                               
    Han Solo                                                   
    RMSysAdmins                                               
    c3po                                                       
    RMSysAdmins                                               
    Darth Vader                                                
    RMSysAdmins                                               
    Boba Fett                                                  
    RMSysAdmins
    Thank you very much for your time,
    Mr Mister

    Hi Mr Mister,
    To get nested group members, this script is for your reference:
    function Get-ADNestedGroupMembers {
    [cmdletbinding()]
    param ( [String] $Group )
    Import-Module ActiveDirectory
    $Members = Get-ADGroupMember -Identity $Group|sort-object objectClass -descending
    $members | % {
    if($_.ObjectClass -eq "group") {
    Get-ADNestedGroupMembers -Group $_.samaccountname
    } else {
    New-Object PSObject -Property @{ username = $_.name;Group = $Group }}
    Get-ADNestedGroupMembers "groupname"
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

Maybe you are looking for

  • How can i write max and min data online during acquisition

    Hello, I am not keen with programming and your help will be greatly appreciated. I make temperature acquisition from an IR camera and I record online 38 different spots at a frequency of 10 samples/min. I also record two temperatures from thermocoupl

  • HT201240 Reset password. Is it work on OS X 10.8?  If I haven't boot disk or recovery?

    1. Turn on macbook and hold Command and S 2.  Type: mount -uw / Enter 3.  Type: launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist Enter 4.  Type: ls /Users Enter See users list and choose yuor user 5. Type: dscl . passwd /Us

  • What does this mean, and what do you do about it?

    So what does it mean? And what can be done about it? I really, really loathe restoring because the software is so appalling bad that every app location as to be reassigned and rebuilt. It always ends up being hours of work, but I have to say the new

  • For ALV Scrol

    Hi Friends, I need to display scrol bar in alv report. If any solutions plz help me. Regards, Subash

  • Help, Strange double clicking on nforce 2

    I've had a microsoft intellieye trackball explorer (try saying that when your drunk) Ever since I installed it onto this new nforce 2 board, it's been double clicking instead of single clicking at appearingly random intervals. I've checked the cable,