Direct Report Lookup

Hi Scripting Guys,
I'm trying to search Active Directory (one specific user) so I can not only see all of this user's direct reports, but any of these accounts that have direct reports themselves.  Ideally, I'd like to output their email addresses rather than distinguished
names.  This is causing me considerable grief and stress.  I'm hoping you can help.  I've included a script that I found which will give me the entire AD database, but I only need one user (manager).
Thanks
G
'========================
Option Explicit
Dim objRootDSE, strDNSDomain, adoCommand, adoConnection
Dim strBase, strAttributes
' Determine DNS domain name.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
' Use ADO to search Active Directory.
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Search entire domain.
strBase = "<LDAP://" & strDNSDomain & ">"
' Comma delimited list of attribute values to retrieve.
strAttributes = "distinguishedName,directReports"
' Document organization.
Call Reports("Top", "")
' Clean up.
adoConnection.Close
Sub Reports(ByVal strManager, ByVal strOffset)
    ' Recursive subroutine to document organization.
    Dim strDN, adoRecordset, arrReports, strReport
    Dim strFilter, strQuery
    If (strManager = "Top") Then
        ' Search for all managers at top of organizational tree.
        ' These are objects with direct reports but no manager.
        strFilter = "(&(!manager=*)(directReports=*))"
    Else
        ' Output object that reports to previous manager.
        Wscript.Echo strOffset & strManager
        strOffset = strOffset & "    "
        ' Search for all objects that report to this manager.
        strFilter = "(manager=" & strManager & ")"
    End If
    ' Construct the LDAP query.
    strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
    ' Run the query.
    adoCommand.CommandText = strQuery
    Set adoRecordset = adoCommand.Execute
    ' Enumerate the resulting recordset.
    Do Until adoRecordset.EOF
        ' Retrieve values.
        strDN = adoRecordset.Fields("distinguishedName").Value
        Wscript.Echo strOffset & strDN
        arrReports = adoRecordset.Fields("directReports").Value
        If Not IsNull(arrReports) Then
            For Each strReport In arrReports
                Call Reports(strReport, strOffset & "    ")
            Next
        End If
        adoRecordset.MoveNext
    Loop
    adoRecordset.Close
'==============
End Sub

Sorry, I'm trying to query a specific user in AD.  This script I've attached outputs the entire AD database.  I need to determine all of the users that report directly into this particular manager.  Also, I need to know if any of these direct
reports have users reporting into them as well.
Finally, I'd like the output to show Email address rather than Distinguished names.
My question...does anyone know what I should modify in this script to get the desired output?  Or, does anyone know of another method that I could use to get the same output?
Hope this brings a little more clarity

Similar Messages

  • Reporting on direct reports by position.

    I currently run reports on line managers and how many people report to them. I do this by using Ad Hoc Query and choosing HR-OM:PPOME (/SAPQUERY/HE). This gives me a list of staff and their line managers. I then run a quick pivot table to get the amount of staff a line manager has reporting to him. However if there are gapped or vacant post between levels, the line manager above the vacant post picks up the employees below the vacant post as their own direct reports.
    I have had a request to create a report that only picks up direct reports, but rather than link the line manager to employees they have working for them, it is a requirement to link the position to the individuals.
    Eg. John Smith (Head of Production) sits at the top of the Organisational Management structure. On the current report Bill Johnson (Production Manager) will be show us one of his reports. However there is a vacant post (Deputy Head of Production) in between the 2 employees which John line manages and Bill reports to. 
    Does anybody know if there is a report that i can run with the position relationships on as well as basic staff data?

    I require the following fields to be output:
    Personnel Number (If Occupied)
    Employee Name (If Occupied)
    Payroll Grade
    Pay Scale Group
    Position Number
    Position Name
    Cost Centre Number
    Cost Centre Name
    Name of Organisational Unit (Division)
    Line Manager's (LM's) Personnel Number  (If Occupied)
    LM's Name (If Occupied)
    LM's Payroll Grade
    LM's Pay Scale Group
    LM's Position Number
    LM's Position Name
    LM's Cost Centre Number
    LM's Cost Centre Name
    LM's Name of Organisational Unit (Division)
    This will include any vacant posts as well as occupied posts. Then i can mess around with pivot tables and lookups in Excel.

  • ARIA Employee Directory -How to Print Multiple Direct Report On a page

    This question goes out to the experts. If we have person that has 10,15 or a large number of direct reports how can we print them on to a page so that they all fit. I am okay if they fall to another line just need to get them all on one page rather than multiple because they fall outside the print parameters?
    All help in this area would be greatly apprecaited
    Steve

    Maybe. Keep in mind HTML was never made for print. It's quite possibly the worst medium you could choose for print. You won't be able to establish page breaks or even draw consistent boxes. In short, I estimate the probability of success in creating an org chart with an HTML template to be somewhere around 1%. I just don't want to see you spend an absurd number of hours trying to build something that's really not possible.
    With that said, here are a few options to consider:
    - Microsoft Word and Visio both have Org Chart functionality, though I'm not sure if you can populate it with data from a database. This would be an offline solution wherein one of the developers would, on a periodic basis, generate a new version of the org chart, export it to PDF, then post it as a static file.
    - Oracle BI Publisher supports Word shapes for templates, including Org Charts per this documentation:
    http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187/T421739T481157.htm#T481174
    though I think it might take effort to get the template to work. At least the output medium (PDF or RTF) is made for print.
    - GraphViz (http://www.graphviz.org) is the most promising online solution I can think of. It's a command-line tool, so you would need to
    -- generate the data in a file and output that to the file system of the database server (UTL_FILE)
    -- call the command-line utility via a dbms_scheduler job, since you need call an OS utility from inside the database
    -- provide a link to the output of graphviz.
    Take a look at this image, then click on it to see the code that generated it, since that's essentially the format you'll need to output:
    http://www.graphviz.org/Gallery/directed/unix.html
    There's my 2 cents. If someone is asking you to do this all in HTML, please send them a link to this post.
    Tyler

  • Can we use Crystal Reports 2008 tool to directly reports on SAP R\3 data?

    Hi,
    Can we use Crystal Reports 2008 Designer to directly reports on SAP R\3 data without any additional Integration Kit for SAP?
    I believe the Integartion Kit is only for reporting on SAP BW data.
    Thanks in advance for your response and any additinal details you can provide.
    Thanks,
    Sri

    Please post this query to the Crystal Reports Design forum:
    SAP Crystal Reports
    That forum is monitored by qualified technicians and you will get a faster response there.
    Thank you for your understanding,
    Ludek

  • Exchange 2010 SP3 Create Dynamic DL for Direct Reports

    I am not sure this is possible but if there is a will there is a way I guess.
    System: Exchange 2010 SP3 on Windows Server 2008 R2
    I am trying to see if there is a way to create dynamic DLs for Manager(s) direct reports.
    Example: Manager has 5 people that report directly to them, is there a way to make an dynamic email distribution list that will poll the direct reports as people leave or hired.
    I know I can create one manually but some depts. may have high turnover rates which increase overhead so I am just trying to simplify the process. I of course googled my question but not getting the results I intended.
    Thanks. 

    hi,
    as from above  i understand you are asking about creating an custom attribute and then referencing them .. if yes please check below command
    Get-Mailbox -OrganizationalUnit Sales | Set-Mailbox CustomAttribute1 "SalesOU"Now you can create an e-mail address policy for all recipients that have the CustomAttribute1 property that equals SalesOU, as shown in this example.
    New-EmailAddressPolicy -Name "Sales" -RecipientFilter { CustomAttribute1 -eq "SalesOU"} -EnabledEmailAddressTemplates "SMTP:%s%[email protected] check this.. http://technet.microsoft.com/en-us/library/ee423541%28v=exchg.150%29.aspx
    MARK AS USEFUL/ANSWER IF IT DID
    Thanks
    Happiness Always
    Jatin

  • Query to get direct report and anyone under them.

    Hello
    Does anyone have a query that would give me a supervisor and his/her direct reports and any direct reports of someone that reports to that supervisor?
    For an example if Kim reports to Jon and Jon reports to Doug and Doug reports to Steve.
    Example
    Steve's direct reports, would be Jon, Doug and Kim
    Jon's direct report, would be Kim.
    Any Idea's
    Thanks,
    KRE

    Please check previous threads -
    Re: How to find loop in Supervisor Hirarchy.
    Supervisor Hierarchy
    Re: Query for Supervisor Hierarchy for top most manager
    Cheers,
    VB

  • MSS Team Overview - Direct Report

    Dear All,
    We are on EP7 and using the web dynpro Team Calendar. The client have requested that in one of the view, it only display the direct employee for the manager (A002 relationship). Anybody knows how to configure the "evaluation path" and the "rule for target object to cater this request".
    Thanks in advance
    Regards,
    Bryan

    Hi Brian,
    In R/3 navigate to t.code SPRO -> Integration with other mySAP.com Components. -> Business Packages/ Functional Packages -> Manager Self- Service -> Object and Data Provider -> Object Provider -> Define Rules for Object Selection
    For direct reports - you can use the existing evalpath MSSDIREC and a rule already exist with the eval path MSS_TMV_RULE5.
    if you want to use a different eval path create a new rule and include that rule into the object selection.
    And in the iView properties need to mention the ruke you created.
    Hope this helps.
    Cheers-
    Pramod

  • Create Dotted line reporting and direct reporting btwn org unit to org unit

    Hi,
    Currently I am working on matrix reporting structure. My requirement is to identify the dotted line reporting as well as direct reporting between org units to org units and where the relationships are storing and which tables.
    Can somebody please help me in this process.
    Thanks,
    kamalesh
    91-9913532050

    Transaction code is ppms for matrix
    Dimension 1- 50005733-A , and what evaluation path?
    Dimension 2-50005837-C, 50005856-D what eavluation path?
    relationship ?
    B position is reporting to A and D org unit,C org unit reporting to Reg head BR these are direct relationship in existing org structure.
    Requirements:
    1.Cleint needs C and D wants to reports A in dotted line relationships.
    2.cleint needs dotted line reports C and A and direct reports of A,Cand D.

  • Moving The Chief Including Direct Reports to Another Org Unit

    Dear Expertise,
    We have a request to move the manager including his direct reports employees to a different org unit.
    I'm looking for a way to achieve this through function module.
    Can anyone shred some light or if any Standard FM available to reuse?
    Your Sincerely,
    SE

    Hi,
    certainly I do not believe there is any standard code for doing this.
    Are you trying to code up an application that lets you do this? If so, the have a look at the decoupled infotype framework classes (CL_HRBAS_* ) for maintaining OM infotypes - you could use these to delimit the old relationships and create new ones in the target org unit.
    In particular have a look at class - CL_HRBAS_PLAIN_INFOTYPE_ACCESS.
    if you're just looking for an easy way to do it - lots of dragging and dropping in PPOME would probably be the easiest!
    hope that helps,
    Chris

  • 'Hierarchy Based Login' and 'Direct Reports' field in Dim - Position table

    Hello -
    I am trying to build a "My Team's" report, which basically shows the logged in Managers ( and his subordinates) revenues rolled up by default. Then the manager needs to drilldown on his name and see revenues grouped by his direct reports. I am using OBIEE 10G. In the out of the box RPD, there are two fields in the BMM layer called 'Hierarchy Based Login' and 'Direct Reports'.
    1. The 'Hierarchy based Login' field uses the INDEXCOL method to get relevant column from the W_POSITION_DH table based on the the Logged in users hierarchy level (the hierarchy level is stored in a session variable (HIER_LEVEL). This session variable works fine and i have tested the SQL)
    2. The 'Direct Reports' is using the same INDEXCOL method, just that it uses the formula HIER_LEVEL - 1. This works fine as well.
    The issue i am facing is neither of these out-of-the-box fields are assigned to the Position dimension (the position dimension also exists OOTB).
    So basically, i am able to create a manager and his direct subordinate report, but without any drill functionality.
    I am trying to get the report to drill all the way down to the bottom most level of the heirarchy.
    Any help to get this working is much appreciated

    What i meant was neither of these out-of-the box fields are assigned to a Dimension Hierarchy ( there is a hierarchy called 'Position' that already exists out-of-the box). Other fields in the 'Dim-Position' table are assigned to a level in this position hierarchy, except these two. I guess what i am trying to achieve is to dynamically assign the hierarchy level based on the users Hierachy level in W_POSITION_DH table.
    Thanks for spending time to look into my issue

  • How to get only direct reporting person under MSS

    Hi All,
    We have got a requirement to Display direct reporting under MSS in EP.
    According to standard SAP functionality there could be only one manager in an orgunit(Chief) and if we need other managers under that we need to create a sub orgunit and make that manager as Chief.
    In Standard functionality it only shows all the employees under that Chief, and shows nothing for other managers in the same org unit.
    Our requirement is that it should show only the direct reporting empoyees irrespetive of Chief in the same orgunit.
    for the purpose system uses two rules: MSS_TMV_RULE1, MSS_TMV_RULE5.
    In these rules two evaluation paths are being used SAP_MANG, MSSDIREC.
    I created custom  evaluation paths, but it's not working.
    Could any of you suggest how to solve this.
    thanks & regards,
    Anuraag

    Hello Anurag,
    We are also implementing MSS without chief positions ....were you able to fix your issue ...please help if you can....

  • Evaluation Path for Direct Reports only

    Hi
    We have written an evaluation path to return direct reports for a given manager (to use in an Adobe Interactive form). We get the correct employees returned, but also the manger himself. Ideally we want a list of names that doesn't include him.
    Here's our path:
    No      Obj      A/B     Rel     Rel name         Priority      Rel Obj Type    Skip
    10       US       B       008     Holder                 *                   S  
    20       P         B       008     Holder                 *                   S
    30       S         A       012     Manages             *                   O
    40       O         B       003     Incorporates        *                   S
    50       S         A       008     Holder                 *                   P      
    What change should we make to not include the manager in the returned set?
    Thanks
    Trish

    Hello,
    Sorry but you can't.
    SAP considers that Manager is not assigned to his own org unit (A012 not equal to A008).
    I had the same issue and i had to create 2 evaluations path :
       - one to get the list of employee (manager include)
       - one to get the manager only
    and exclude the second one in the report.
    Edited by: Cédric LEFRANCOIS on Dec 21, 2009 11:47 AM

  • EHP5 Team calendar to view direct reports

    Dear All,
    Can anyone help, Currently I have made the settings in IMG and the team view in team calendar is icking up the employees in the Same Organisation unit. The requirement is to pick the Direct reports. In all the help documents it says to select  ESS_LEA_EE_DIR options in the drop down in table "V_ptreq_team" however this option is not avilable in the f4 list. Is there another setting i have to maintain before doing this step?
    http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=190743879
    Best regards
    keshini

    ESS_LEA_EE_DIR this option comes later in OADP as explained in my WIKI
    In ESS, in standard an employee sees his peers in org unit, only manager sees his direct reports!
    Team calendar works on evaluation path to display the employees
    Please check the table V_ptreq_team for Leave request which uses
    ESS_LEA_EE and which in turn uses ESS_LEA_EE_DIR (V_TWPC_ORGVWGRP)
    In this table you define different rules V_TWPC_OBJSEL
    ESS_LEA_EE_DIR ESS_LEA_RULE1      ESS_LEA_RULE5 Absence: Direct Colleagu
    This table you define the Evaluation path
    V_TWPC_OBJSELRUL
    ie
    use the FM option in the Object Selection rules
    "ESS_LEA_RULE1" and "ESS_LEA_RULE5" to determine the OrgUnit and the
    employees of that Org Unit. In the Object Selection rule, you store the
    name of the function module that can be used as opposed to the evaluatio
    n path to determine the relevant objects. Depending on the type of rule,
    you can use one of the following function modules as the basis for
    creating a function module of your own:
    o   Rules for determining root objects: HRWPC_PATHROOTS
    o   Rules for determining navigation or target objects: HRWPC_ EVAL_PATH
    or use this
    Table V_TWPC_V ESSDIR
    View                                     ESSDIR
    View Name                                ESS: Direct Employees
    Eval. Path for Root Objects         SAP_MANG or ORGASS or WF_ORGUN
    Function Module Root Objects
    Evaluation Path Objects                  ORGASS
    Function Module Object Set
    Initial Evaluation Depth                 0
    you can find documentation related to the OADP Object and Data Provided
    on the next link:
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/e7/947e40ec66ce62e1000000
    0a155106/frameset.htm
    Here you can find a detailed explanation about the customizing and there
    is an example on the link:
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/de/2fba0f23bc40f6bea53942
    26ef129f/frameset.htm

  • How to Default 'Directly reporting employees' in Team Viewer

    Hi,
    Currently Team viewer in MSS has 'All Employees' by default. We have a request to change it to 'Directly reporting employees'. Can anyone suggest how we can acheive this?
    Thanks,
    Swapna

    Hi Prashant,
    We are in 46c and view V_TWPC_ORGVWGRP does not exist in our system. I changed the order in view V_TWPC_VG. Order is changed in Tem viewer, but still defaulting 'All Employees'.
    Thanks,
    Swapna

  • Terminated/inactive employees show in direct reports

    We're using HCM 9.1. When a manager looks at his direct reports, sometimes employees that have been terminated/inactive appear in the hierarchy. The termination date is long before the as of date on the direct reports page.
    On the Direct Reports Configuration page, we've tried two settings for Access Type: By Reports To Position and By Part Posn Mgmt Supervisor. Each of these Access Types results in seeing terminated/inactive employees in the direct reports list.
    Is there a way to prevent a terminated/inactive employee from appearing in a direct reports page?
    Edited by: kcjim on Feb 5, 2013 2:42 PM

    Thanks Hakan. I think the issue I'm having is very closely related to the one you have pointed out to me. Unfortunately we're on bundle 9 and I'm not sure when we may go to bundle 10. Maybe I can work with Oracle support for a temporary solution. Thanks again for your help!

Maybe you are looking for

  • When I try to open it, it shows a little box that you can't maximize and if you try to close it it says ''the application is not responding'' help?

    Hello, I really need your help. When I try to open firefox, nothing happens or it will open a really small and empty window in the top corner of my laptop. That window cannot be maximized and if I try to close it either nothing happens or it says tha

  • Cluster and L1000 Tape Library

    We are planning to purchase a tape library system for backing up the data on our cluster. I was wondering if any one ever used the Sun L1000 Tape library system with NetBackup. How do you like the L1000 and NetBackup? Is the L1000 tape library reliab

  • Deploying jClient app

    Another newbie question - I have an application with a model project and a view project in which I have built an ADF application mainly using the wizards so everything is pretty standard. The app connects to a local Oracle database on my PC. My littl

  • Why can't I type the "5"/ "T" key on my iPod touch?

    So about 2 hours ago my iPod Touch, 3rd generation just randomly started freaking out. The screen would shake a lot when I tried to drag my finger on it and it randomly started doing stuff like opening apps that I hadn't clicked on and magnifying the

  • Program NI boards using the DAQ Libary and Borland C++ builder 5

    Hi, I am programming Lab PC-1200 NI boards using the DAQ Libary and Borland C++ builder 5. But I get the following error msg:"[Linker Error] 'C:\NI-DAQ\LIB\NIDEX32.LIB' contains invalid OMF record, type 0x21 (possibly COFF)" although I have linked al