473,598 Members | 2,916 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ADSI WinNT:// provider

In VB, I can write the following code to get the list of
users and groups in the domain ASIA. How do I do the same
in C#

Set objContainer = GetObject("WinN T://ASIA")
objContainer.Fi lter = Array("user", "group")
For Each user In objContainer
List1.AddItem user.Name
Next

Thanks and Regards,
Thomaz
Nov 15 '05 #1
4 14033
Check the System.Director yServices namespace in MSDN.
http://msdn.microsoft.com/library/de...opytotopic.asp

And start reading "Creating DirectoryEntry Component Instances"
http://msdn.microsoft.com/library/en...asp?frame=true

I would also suggest to drop the WinNT provider in favor of the LDAP
provider when running a AD domain.

Willy.

"Thomaz" <an*******@disc ussions.microso ft.com> wrote in message
news:01******** *************** *****@phx.gbl.. .
In VB, I can write the following code to get the list of
users and groups in the domain ASIA. How do I do the same
in C#

Set objContainer = GetObject("WinN T://ASIA")
objContainer.Fi lter = Array("user", "group")
For Each user In objContainer
List1.AddItem user.Name
Next

Thanks and Regards,
Thomaz

Nov 15 '05 #2
using System.Director yServices;

DirectoryEntry objContainer = new DirectoryEntry( "WinNT://ASIA");
objContainer.Ch ildren.SchemaFi lter.Add("group ");
objContainer.Ch ildren.SchemaFi lter.Add("user" );
foreach(Directo ryEntry objItem in objContainer.Ch ildren) {
List1.AddItem(o bjItem.Properti es["cn"][0].ToString());
}

From the top of my head.
Arild

"Thomaz" <an*******@disc ussions.microso ft.com> wrote in message
news:01******** *************** *****@phx.gbl.. .
In VB, I can write the following code to get the list of
users and groups in the domain ASIA. How do I do the same
in C#

Set objContainer = GetObject("WinN T://ASIA")
objContainer.Fi lter = Array("user", "group")
For Each user In objContainer
List1.AddItem user.Name
Next

Thanks and Regards,
Thomaz

Nov 15 '05 #3

System.Director yServices.Direc toryEntry entryRoot
= new System.Director yServices.Direc toryEntry
("WinNT://danny-4649bwcv8", null, null,
AuthenticationT ypes.None );
try
{

System.Director yServices.Direc toryEntries
userEntries = entryRoot.Child ren;
foreach
(System.Directo ryServices.Dire ctoryEntry user in
userEntries)
{
if
(user.SchemaCla ssName.Equals(" User"))

Console.WriteLi ne(user.Name);
}
}
catch
(System.Runtime .InteropService s.COMException e)
{
Console.WriteLi ne
( "Error " + e);
}

-----Original Message-----
In VB, I can write the following code to get the list of
users and groups in the domain ASIA. How do I do the same
in C#

Set objContainer = GetObject("WinN T://ASIA")
objContainer.Fi lter = Array("user", "group")
For Each user In objContainer
List1.AddItem user.Name
Next

Thanks and Regards,
Thomaz
.

Nov 15 '05 #4
System.Director yServices.Direc toryEntry entryRoot
= new System.Director yServices.Direc toryEntr
("WinNT://danny-4649bwcv8", null, null,
AuthenticationT ypes.None )
tr
System.Director yServices.Direc toryEntries
userEntries = entryRoot.Child ren
foreac
(System.Directo ryServices.Dire ctoryEntry user in
userEntries

i
(user.SchemaCla ssName.Equals(" User")

Console.WriteLi ne(user.Name)
catch
(System.Runtime .InteropService s.COMException e
{
Console.WriteLi n
( "Error " + e)

-----Original Message----
In VB, I can write the following code to get the list of
users and groups in the domain ASIA. How do I do the same
in C
Set objContainer = GetObject("WinN T://ASIA"

objContainer.Fi lter = Array("user", "group"
For Each user In objContaine
List1.AddItem user.Nam
Nex
Thanks and Regards

Thoma



Print | Copy URL of this post

.. .
Contact Us | Rules of Conduct
©2004 Microsoft Corporation. All rights reserved. Terms of Use | Privacy Statement

Nov 15 '05 #5

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

Similar topics

2
7181
by: Blake | last post by:
Windows 2000 Active Directory, IIS 5 ASP code looks like this: Set oUser = GetObject("WinNT://DOMAIN/" & strNTName) oUser.ChangePassword strPassword, strNewPassword If (err.number <> 0) Then response.write(err.number) End If
5
10201
by: Blake | last post by:
ASP code looks like this (win2k, IIS 5, Win2k AD): <% Set oUser = GetObject("WinNT://ourdomain/testuser") response.write("user = " & oUser.Name) %> output is this: error '80070035'
2
3673
by: Blake | last post by:
single ASP page running on IIS 5 on a Native Windows 2000 AD: <%Set usr = GetObject("WinNT://LONGWOOD/duffeyba,user")%> (the IIS machine is a member server) The page is running as the user 'duffeyba'. I am getting this result:
2
3507
by: Dan Varozza | last post by:
I am trying to write a program in VB.NET to work with Active Directory user accounts in my Win2K domain. I found sample code as shown below but when I add it to a project it says "Type IADsContainer is not defined" and "Type IADsUser is not defined". What is wrong? Am I missing a reference or something else? Example: Creating a User Object (Visual Basic) Dim Container as IADsContainer Dim NewUser as IADsUser ‘ Bind to the known...
4
2103
by: John P | last post by:
My application needs to enumerate computers on both AD domains and also on existing NT domains. The earch of Ad domains was a snap, but the WinNT provider errors out telling me you cannot search on this provider. I need to return a list of computers (and distinguish servers fron workstations) in a particular NT domain. Anybody out there run into this?
1
1906
by: Matthias Mohr via .NET 247 | last post by:
Hello, I'm trying to get Users that belong to a group with the WinNT Provider in an ASP.NET environment. I found several examples to do this under ASP using the GetObject-Method (GetObject("WinNT//:Domain/...). But how does it work in VB.NET? Can I use the GetObject-Method, or is the usage of DirectoryServices or ADSI the right way?An example please. Matthias -------------------------------- From: Matthias Mohr
0
1201
by: Trevor Lawrence | last post by:
I am trying to clean up the remnants of an old NT4 domain and am trying to create a DirectoryEntry object referring to an NT4 group via the WinNT provider. That part works fine, but I cannot find a way to get the membership of the group. The same kind of operation works fine on members of an AD group via the AD LDAP provider. Anyone know how I might get NT4 group members without using Interop? Trevor
3
5864
by: TomikZ | last post by:
I'd like to get some user account properties using .asp script. When I try to use ADSI WINNT provider it works fine except that I apparently cannot access some properties such as objUser.managedObjects. I have this simple code: <% Set objUser = GetObject("LDAP://CN=Users,CN=FisrtName LastName,DC=MyDomain,DC=com") For Each strValue in objUser.managedObjects Response.Write "This: " & strValue & "<br>"
8
3122
by: John | last post by:
Hi, gurus, How can I implement the following feature in C#: Set objGroup = GetObject("WinNT://" & strComputer & "/" & strGroup & ", group") For Each objMember In objGroup.Members WScript.Echo vbCrLf & " Name: " & objMember.Name Next
0
7981
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
7894
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,...
1
8046
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
8262
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...
0
5437
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3894
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3938
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1500
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1245
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.