473,406 Members | 2,390 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,406 software developers and data experts.

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=ADomain,DC=com");
DE.Children.Add("Philip", "user");
DE.CommitChanges();

This script does absolutely nothing. Why?
Thanks,
Philip


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

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

Willy.

"Philip Carnstam" <ph****@carnstam.net> wrote in message
news:eh**************@TK2MSFTNGP12.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=ADomain,DC=com");
DE.Children.Add("Philip", "user");
DE.CommitChanges();

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*************@TK2MSFTNGP12.phx.gbl...
Your DirectoryObject should at least contain a correct LDAP ADsPath;
LDAP://HostName[:PortNumber][/DistinguishedName]

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

Willy.

"Philip Carnstam" <ph****@carnstam.net> wrote in message
news:eh**************@TK2MSFTNGP12.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=ADomain,DC=com");
DE.Children.Add("Philip", "user");
DE.CommitChanges();

This script does absolutely nothing. Why?
Thanks,
Philip


Nov 16 '05 #3
>DirectoryEntry DE = new DirectoryObject("CN=users,DC=ADomain,DC=com");

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

DirectoryEntry DE = new
DirectoryObject("LDAP://CN=users,DC=ADomain,DC=com");
DE.Children.Add("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.CommitChanges();


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.CommitChanges();

Now you should see your new user object in AD.

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

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

Similar topics

4
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...
8
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...
15
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...
2
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...
9
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',...
2
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...
12
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...
11
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...
17
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:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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,...
0
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...

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.