473,666 Members | 2,357 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating a User object in AD

Hi,

Can someone lead me through creating a user object in AD.

I have tried creating one through LDAP and ADSI (WinNT://) but nothing
happens.

DirectoryEntry DE = new DirectoryObject ("CN=users,DC=A Domain,DC=com") ;
DE.Children.Add ("Philip", "user");
DE.CommitChange s();

This script does absolutely nothing. Why?
Thanks,
Philip


Nov 16 '05 #1
3 1986
Your DirectoryObject should at least contain a correct LDAP ADsPath;
LDAP://HostName[:PortNumber][/DistinguishedNa me]

In your case
DirectoryEntry DE = new
DirectoryObject (LDAP://serverName/CN=users,DC=ADo main,DC=com);
Where serverName is the name of the AD server host or the domain name.

Willy.

"Philip Carnstam" <ph****@carnsta m.net> wrote in message
news:eh******** ******@TK2MSFTN GP12.phx.gbl...
Hi,

Can someone lead me through creating a user object in AD.

I have tried creating one through LDAP and ADSI (WinNT://) but nothing
happens.

DirectoryEntry DE = new DirectoryObject ("CN=users,DC=A Domain,DC=com") ;
DE.Children.Add ("Philip", "user");
DE.CommitChange s();

This script does absolutely nothing. Why?
Thanks,
Philip

Nov 16 '05 #2
The address is not the problem, I know the one entered here was not fully
correct. I can access any object, I just can't create new ones.
"Willy Denoyette [MVP]" <wi************ *@pandora.be> wrote in message
news:eg******** *****@TK2MSFTNG P12.phx.gbl...
Your DirectoryObject should at least contain a correct LDAP ADsPath;
LDAP://HostName[:PortNumber][/DistinguishedNa me]

In your case
DirectoryEntry DE = new
DirectoryObject (LDAP://serverName/CN=users,DC=ADo main,DC=com);
Where serverName is the name of the AD server host or the domain name.

Willy.

"Philip Carnstam" <ph****@carnsta m.net> wrote in message
news:eh******** ******@TK2MSFTN GP12.phx.gbl...
Hi,

Can someone lead me through creating a user object in AD.

I have tried creating one through LDAP and ADSI (WinNT://) but nothing
happens.

DirectoryEntry DE = new DirectoryObject ("CN=users,DC=A Domain,DC=com") ;
DE.Children.Add ("Philip", "user");
DE.CommitChange s();

This script does absolutely nothing. Why?
Thanks,
Philip


Nov 16 '05 #3
>DirectoryEnt ry DE = new DirectoryObject ("CN=users,DC=A Domain,DC=com") ;

This is an invalid LDAP bind string..... it should be something like
this:

DirectoryEntry DE = new
DirectoryObject ("LDAP://CN=users,DC=ADo main,DC=com");
DE.Children.Ad d("Philip", "user");
This is invalid again - you'll need to specify the user name in LDAP
style, e.g. including the cn= prefix:

DE.Children.Add ("cn=Philip" , "user");
DE.CommitChang es();


And before that, you will need to set at least all the mandatory
properites of the user object, which includes the samAccountName,
which has to be unique in the whole domain:

DE.Properties["sAMAccountName "].Value = "philipp";

THEN

DE.CommitChange s();

Now you should see your new user object in AD.

Marc
=============== =============== =============== =============== ====
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)i nova.ch
Nov 16 '05 #4

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

Similar topics

4
561
by: Altramagnus | last post by:
I have 30 - 40 type of different window. For each type I need about 20 instances of the window. When I try to create them, I get "Error creating window handle" My guess is there is a maximum number of window handle, because if I reduce to about 2 instances of each window, it can run. But not 20 instances of each window. Does anyone know what the problem is? is it really because it exceeds the maximum number of window handle?
8
3990
by: mcmg | last post by:
Hi, I have an asp app that works fine on a windows xp machine but does not work on a windows 2000 server. I have the following code in my global.asa: <OBJECT RUNAT=Server SCOPE=SESSION ID=MyID
15
6743
by: Carlos Lozano | last post by:
Hi, What is the right way to create an OCX COM component. The component is already registerred, but can't create an instance. I am using the reference to the interop module created. If I use javascript or vbscript it works. I will appreciate any help. I do the following (C#):
2
2007
by: DaWoE | last post by:
Hi all, I'm fairly new to ASP.NET. What i want to do is creat a online registration form. On the first step is getting the users details and the number of people he wants to register. Based on the number of people i want to create a form where he can enter the persons details. For example he wants to register 3 people. Then the second step of the registration would have to be like this :
9
3912
by: kermit | last post by:
I keep seeing that you can use the FileSystemObject in either VB script, or Javascript on an aspx page. I added a refrence to the scrrun.dll I added importing namespaces for 'System.Object', 'Scripting', 'Scripting.FileSystemObject', and a few others However, when I try to create the fso object I keep receiving an error. 'ActiveX component can't create object: 'Scripting.FileSystemObject'
2
1240
by: vvenk | last post by:
Hello: I am thinking of an object called "user." This object will be instatntiated during a login process. But I want to use this to control the behavior of the application since it will also encapsulate the logged-in user's security profile. What is the best strategy for creating one such object? I initially thought of having a module wherein it is declared public. Even
12
3153
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without restarting the application. What I did was to create an AppDomain that loaded the plugins and everything was great, until I tried to pass something else that strings between the domains...
11
2311
by: rayala | last post by:
Hi all, I am having very weird problem in my Outlook I am running my web application from with in Outlook.I found a strange problem that it is creating different sessionId if i open a new window using window.open from with in my application.I am pulling my hair all along but no solution so far.Hope you guys can help me out. my application works fine when i run this in IE.It is Outlook2003
17
46521
Motoma
by: Motoma | last post by:
This article is cross posted from my personal blog. You can find the original article, in all its splendor, at http://motomastyle.com/creating-a-mysql-data-abstraction-layer-in-php/. Introduction: The goal of this tutorial is to design a Data Abstraction Layer (DAL) in PHP, that will allow us to ignore the intricacies of MySQL and focus our attention on our Application Layer and Business Logic. Hopefully, by the end of this guide, you will...
0
8440
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
8863
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8780
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
8549
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
5661
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
4192
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
4358
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1763
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.