473,412 Members | 4,594 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Manager of OU

Daxthecon
C# question. I am working on a web app to find a manager of the current users OU and post there name to a label at the bottom with a case statement. In the same context if the person accessing the page is the manager of the OU then I'd like to let them see a hidden field. Now I know the answer is out there and now one can seem to tell me how to access it and convert it to string. I keep getting stuck when I search for it. I thought it would be the managedBy but that is not a readable characteristic and it doesn't really resolve the fact that it's not displaying or even able to read the attribute. I must be doing something wrong or not seeing something that I should be. I've searched ParentProperty on msdn and googled every version of "Manager of OU Active Directory" that I can. And after about 75 pages on each search of 20 results I've been nowhere. Now to my exhaustive effect I am posting this issue to you guys in hope someone knows. Thanks for any help in advance.
Sep 22 '08 #1
12 1999
Frinavale
9,735 Expert Mod 8TB
In the future could you please break up your question in to paragraphs so that it's easier for us to read.

I need to know what you have tried so far.
You're going to have to set up your web application to use Windows Authentication...

You should be able to grab the current user.

Please note that Windows Authentication has it's draw backs and you should research it before deciding to implement it.

-Frinny
Sep 22 '08 #2
Sorry. My thoughts at this point are just symbols. Miracle I can make sense of them. Now to the specs of everything:

Project Background: Intranet set on IIS as a file system. AD is connected via a forest. RootDSE works due to one Domain Controller holding only One AD.

Problem: I have a DirectorySearcher fetching all the attributes and then calling them via
Expand|Select|Wrap|Line Numbers
  1. Name.text = result.Properties["name"][0].ToString();
Other code follows in the same suit of the phone and department and so on. I need to find the manager of the department of the person who is accessing the site(if that makes any sense) and putting that name in the text field named depthead. Finding the manager of the OU has been quite difficult.

Sought Solution 1: Wrote an array to look at the current users managers manager. It's innacurate because it's only finding a heirarchy of the people not the manager of the OU. Example: Person 1 is being managerd by person 2 and person 2 by person 3 and that person is the manager of the OU(department) but they are in turn managed by the big guy Person 4. And you can't tell it to stop at 3 because some only have 2 people above them and so on.

Sought Solution 2: managedBy. This doesn't return anything. No true or false or string of any kind. IT's just blank. I have multiple programs that have tried to pull this attribute out to see if there is a value but it isn't there.

Sought Solution 3: SDS.Parent property. I haven't really been able to unlock the full potential of this one. And Joe Kaplan(author of Active Directory programming) has been helping me out and said this is the best way to go. I just can't find enough literature or code to make a proper example to see how it works and what it does.

Hope this is spread out and catergorized and in a good format for you. I am trying to keep the langoliers from eating the thoughts I am not using so everything, like I said, is a mess up in the top room. And no I didn't get a weekend.
Sep 22 '08 #3
NeoPa
32,556 Expert Mod 16PB
Am I right in thinking you're after the MetaData of the accessible AD information?

I may be entirely unable to help even so, but I may have done some digging myself in a similar area (All in VBScript though) and might have some notes at work that might help some. I'll post something for you if I can find anything that looks related (It's been a while since I did it I'm afraid so my memory of it is more than a little rusty).
Sep 22 '08 #4
NeoPa
32,556 Expert Mod 16PB
Sorry. My thoughts at this point are just symbols. Miracle I can make sense of them. Now to the specs of everything:
...
Hope this is spread out and catergorized and in a good format for you. I am trying to keep the langoliers from eating the thoughts I am not using so everything, like I said, is a mess up in the top room. And no I didn't get a weekend.
That is much better. My sympathies are with you :)

I wish more members even COULD lay it out clearly like that. Normally a request like that is followed by further gibberish, but now with attitude because they've gone to the extra effort for you.
Sep 22 '08 #5
NeoPa
32,556 Expert Mod 16PB
I'm afraid that what I found was probably not too helpful for your particular requirement :(

Here are a couple of links though. I wish I could say they were more relevant to you but I'm not sure. I hope at least they will give a starting point into discovering the relevant area of the LDAP tree that you need.

http://msdn.microsoft.com/en-gb/library/aa772170.aspx
http://forums.asp.net/p/993762/1295799.aspx

I know the following code won't be relevant to you as it stands, but it gives an illustration of the sort of handling required to access the main LDAP object.
Expand|Select|Wrap|Line Numbers
  1. 'Set up the objects that are expected to be there
  2. Sub Initialise()
  3.   Set objShell = CreateObject("Shell.Application")
  4.   Set objScriptShell = CreateObject("WScript.Shell")
  5.   Set objNetwork = CreateObject("WScript.Network")
  6.   Set objFS = CreateObject("Scripting.FileSystemObject")
  7.   Set objADUser = GetObject("LDAP://" & _
  8.           CreateObject("ADSystemInfo").UserName)
  9.   Call GetGroups()
  10. End Sub
Sep 23 '08 #6
Thanks a lot of the work you have done. I was ordered to take a break for a few hours(or else I would have burned through the night still trying to figure it out). One of those "it's almost there" situations that I can't let sit.

I then barted with my boss to make groups. Hoooraaayyyy. I Hope to find some way to logic out who is who's dept head. But no one seems to be able to know how to get the manager of the OU. Any other help would be much appreciated and thanks for helping me in great length. I can't let enough poeple know how good it feels to know someone out there took a few minutes out of their day to help.

If anymore solutions on my end or your guys' end come about please post them here. If I solve this. You can be sure that it will be here in all it's glory.
Sep 23 '08 #7
NeoPa
32,556 Expert Mod 16PB
I'll certainly try to bear this thread in mind if I play in that area again, although I don't find anything in my AD that even refers to Managers for user accounts (I'm very rusty in this whole area though as I've not worked on this for some months).
Sep 23 '08 #8
What I know about the Manager Attribute is that it returns the whole string in which the manager of the user is. cn=manager name, ou=IT,ou=company, dc=blah, dc=blah. If your run a split on ',' you can single out the name and post it to a string.

My boss says there is a setting for Managed By of the Ou. But I have tried the managedBy. Maybe I am not doing that properly. I tried an array that checked the ou runs the ou against the managedBy and it returned no value. It ran just no value. If anyone has an array that they know might work please send it to me.
Sep 23 '08 #9
NeoPa
32,556 Expert Mod 16PB
I think the field is actually "manager".
Expand|Select|Wrap|Line Numbers
  1. manager: CN=Fred.Bloggs,CN=Users,DC=coname,DC=co,DC=uk
I have found some other, older, stuff, which may help you to see some of this information more clearly yourself. I will dig for some further clarification for you.

PS. If I can find them I will post the links where I learned most of the info from.
Sep 24 '08 #10
NeoPa
32,556 Expert Mod 16PB
The following is an example of how to extract information related to AD into a file (C:\NewDomain\STPUsers.Ldf).
Expand|Select|Wrap|Line Numbers
  1. ldifde -f C:\NewDomain\STPUsers.Ldf -n -r "(&(objectClass=User)(scriptPath=LogOn.Cmd))"
This example selects only those items of objectClass=User whose scriptPath is set to LogOn.Cmd.
It shows all the available information for each object found. It connects to the local DC. I run this on the DC itself for simplicity.
Sep 24 '08 #11
NeoPa
32,556 Expert Mod 16PB
Some potentially useful links.

The first has a link to getting the AD Schema which may be enough to answer all your questions ;)
http://msdn.microsoft.com/en-us/library/aa705950.aspx

The next one has help with LDAP filtering.
http://technet.microsoft.com/en-us/l.../aa996205.aspx

This one has general help (with scripting examples) on AD user accounts.
http://www.microsoft.com/technet/scr....mspx?mfr=true

These help with LDIFDE. This is a command line tool that I found invaluable in helping me determine teh schema of the AD areas I was using. See previous post for a simple example.
http://www.computerperformance.co.uk...VDE_LDIFDE.htm
http://msdn.microsoft.com/en-us/library/ms870068.aspx
Sep 24 '08 #12
NeoPa
32,556 Expert Mod 16PB
I found the Manager item in the AD Users and Computers interface now. It's in the Organization tab, vertically half-way down.

How that is structured in your organisation depends on you. The top man could have a blank manager, or he could point to himself. Your code could handle that either way (Let's just hope no numb-nuts has put a loop in there :D).
Sep 24 '08 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: semarketing-request | last post by:
>>>> This is a multi-part message in MIME format. **** Command 'this' not recognized. **** No valid commands found. **** Commands must be in message BODY, not in HEADER. **** Help for...
1
by: Carl Bevil | last post by:
Hello all. If I want to use a custom memory manager to, say, track memory allocations in Python, what's the best way to do this? I seem to remember there being a way in version 1.5 (or so -- been...
3
by: Navin | last post by:
hi, guys i have query which given below output given below manager personlevel person name 2085 1 Howard Wilson1 2085 2 Howard Wilson2 2085 3 Howard Wilson3 2085 4 Howard Wilson4...
4
by: John Morgan | last post by:
I have Enterprise Manager on my local machine. For the last twelve months it has been connecting without problem to my online SQL Server database provided by my ISP. Three weeks ago the ISP...
3
by: Fresh Air Rider | last post by:
Hi SQL Gurus Could anyone please explain how the following stored procedure can be amended to retrieve Subordinates in alphabetical order ? The example below simply retrives records in the...
1
by: mikew | last post by:
I am working at a company that has been using MS SQL Server, and we are going to be switching over to postgresql next week. (Getting off of Windows will be a relief!) I am very familiar with SQL...
0
by: Zorba.GR | last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64 bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager...
0
by: Yoni Gibbs | last post by:
Hi, I need to build a "login manager" using C#, for a desktop application. I am new to .NET, having previously only worked in COM, so please forgive my ignorance. What I need is a "login...
2
by: AH | last post by:
Dear all, I am facing this 'bug' that really drive me nut. I created a trigger for Update script and tested in Enterprise manager to ensure it function correctly. However, when I used both VB or...
1
by: Miro | last post by:
I am going throug a vb 2005 book, but I am using vs 2008 professional, and I cant seem to find a menu option its talking about. I am wondering if this has moved - i cannot seem to find it for the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.