473,804 Members | 2,985 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

User Listing from AD

I need to get a listing of users from Active Directory. Getting the list is
no problem using the DirectorySearch er class. My problem is getting the full
legacy-style domain name of the user (in the form of domain\username ). The
"sAMAccountName " property only gives me the username portion. What property
gives with the domain? Or do I need to be looking at a different AD object
altogether?

Thanks,
Jason
Jul 21 '05 #1
3 1845
>I need to get a listing of users from Active Directory. Getting the list is
no problem using the DirectorySearch er class. My problem is getting the full
legacy-style domain name of the user (in the form of domain\username ). The
"sAMAccountNam e" property only gives me the username portion. What property
gives with the domain? Or do I need to be looking at a different AD object
altogether?


You can't get that from a user object - you'd have to go inspect the
"domainDNS" object that this user (or those users) are contained
under.

E.g. you'd have to walk up the AD object tree (by looking at the
DirectoryEntry. Parent property repeatedly) and go find the object of
class "domainDNS" - it will contain an attribute called "name" which
is the NetBIOS style name of the domain.

MArc

=============== =============== =============== =============== ====
Marc Scheuner May The Source Be With You!
Berne, Switzerland m.scheuner -at- inova.ch
Jul 21 '05 #2
Thanks Marc for the info.

Looks like I need to look at the instanceType field that specifies that
object type? (In this case the value 5 indicates domainDNS) Or should I be
looking at something else?

- Jason

"Marc Scheuner [MVP ADSI]" <m.********@ino va.SPAMBEGONE.c h> wrote in message
news:6l******** *************** *********@4ax.c om...
I need to get a listing of users from Active Directory. Getting the list
is
no problem using the DirectorySearch er class. My problem is getting the
full
legacy-style domain name of the user (in the form of domain\username ). The
"sAMAccountNa me" property only gives me the username portion. What
property
gives with the domain? Or do I need to be looking at a different AD object
altogether?


You can't get that from a user object - you'd have to go inspect the
"domainDNS" object that this user (or those users) are contained
under.

E.g. you'd have to walk up the AD object tree (by looking at the
DirectoryEntry. Parent property repeatedly) and go find the object of
class "domainDNS" - it will contain an attribute called "name" which
is the NetBIOS style name of the domain.

MArc

=============== =============== =============== =============== ====
Marc Scheuner May The Source Be With You!
Berne, Switzerland m.scheuner -at- inova.ch

Jul 21 '05 #3
>Looks like I need to look at the instanceType field that specifies that
object type? (In this case the value 5 indicates domainDNS) Or should I be
looking at something else?


Yes - why not look at the "DirectoryEntry .SchemaClassNam e" property??

It will contain the schema class name, e.g. "user" for users,
"domainDNS" for domains, "group" for groups and so on.

Marc

=============== =============== =============== =============== ====
Marc Scheuner May The Source Be With You!
Berne, Switzerland m.scheuner -at- inova.ch
Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1548
by: Neal | last post by:
Hi, I'm fairly new to developing PHP / MySQL databases. I've just created a job posting board that works OK, but I want this feature: user creates their username/password to enter a listing. Once they've entered a job listing, they can login again and will be able to edit / drop their listing only. Any pointers in the right direction would be appreciated.
6
2118
by: Brad | last post by:
I have an sql query that has specific criteria (like state='PA' or state = 'NJ'...) and would like to be able to have the user specify the criteria dynamically either through the web or from MSAccess or another tool. The query also does a GROUP BY the state and other variables that are part of the criteria. I know how to get MSAccess and asp pages to do the sorting and selecting against an SQL tbl or view, but when access queries the...
3
2046
by: David Jacques | last post by:
I am trying to get a list of all files of a certain extension type on disk to do some processing in a loop. The code needs to be portable to UNIX, so I need to use plain c functionality. Does anyone know of a way to do this ? Any URLs, code snippets, etc ?
0
2423
by: Norbert Heidbüchel | last post by:
Hi all, I have read a lot of postings and web pages about drag and drop and treeviews, but could not find an answer to my problem. Sorry, if I missed something. I am trying to drag and drop treenodes defined by myself and don't understand, how to get the nodes data in the dragdrop event. I'm not very experienced in .NET and for sure there is a simple solution. I've written a short sample program, based on well known examples,
2
1244
by: moondaddy | last post by:
I have a user control that's used to display the products listing in the main part of a page. This control is populated with a listing of products from the database based on a category name passed into it via a function in the code behind like this: 'Note, when we aren't looking at products, the product listing user control gets switched out for a different user control such as aboutus.ascx or something. 'This is a function in...
3
345
by: Jason | last post by:
I need to get a listing of users from Active Directory. Getting the list is no problem using the DirectorySearcher class. My problem is getting the full legacy-style domain name of the user (in the form of domain\username). The "sAMAccountName" property only gives me the username portion. What property gives with the domain? Or do I need to be looking at a different AD object altogether? Thanks, Jason
2
1990
by: s.chelliah | last post by:
We have an input field which allows the user to enter a string of (up to 62) ASCII printable characters. We have a need to allow the user to be able to specify any sequence of characters he/she desires. However, we have a problem when we attempt to display this same string of characters. If the input sequence of characters contains HTML interpretable strings of characters, the user's sequence of characters is not properly displayed. (We...
1
5323
by: vhg119 | last post by:
Can someone please link me to some resource listing all the user attributes names? I'm writing some C# code using the System.DirectoryServices assembly. This particular function is suppose to search for a user by "displayName" and set the users phone numbers. I have an incomplete list of Properties: displayName, givenName, sAMAccountName... I need the property names for: "Telephone number" in the General tab of Active Directory Users...
3
4934
by: =?Utf-8?B?ZG1idXNv?= | last post by:
I would like a listing of all users in the current domain (or on my computer). I'm running Windows XP Home Edition and I've set up four user, one for each member of my family. 'My.User.Name' just lists me. How do I get the others? I looked at some code posted here on 4/27/07 and it doesn't work, I've already tried it. Thanks in advance. --
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9577
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10315
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.