?
Solved

C# code for adding a computer to Active Directory

Posted on 2008-10-22
5
Medium Priority
?
1,711 Views
Last Modified: 2013-12-17
HI

I need help with adding a computer to Active Directory using c#

Given parameters:

1) Computer name
2) LDAP path in which the computer is created
3) The user that is associated with this computer
4) The password of the user that is associated with this computer

0
Comment
Question by:elimesika
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 8

Assisted Solution

by:mikainz
mikainz earned 150 total points
ID: 22774867
0
 
LVL 15

Assisted Solution

by:angus_young_acdc
angus_young_acdc earned 1350 total points
ID: 22774869
0
 
LVL 19

Author Comment

by:elimesika
ID: 22775478
HI mikainz & angus_young_acdc

Sorry, non of those links talks about adding computers, I have already managed the code for adding users.

I would appreciate a more specific , with relevant sample code answer.

Thanks
0
 
LVL 15

Accepted Solution

by:
angus_young_acdc earned 1350 total points
ID: 22775803
I would imagine its a very similar process to adding a user.  Selecting the group (the workstations), and adding the name, location and other properties.  Something similar to the following:
            DirectoryEntry dirEntry = new DirectoryEntry("LDAP://");
            dirEntry.Properties["CompName"].Add("myCompName");
            dirEntry.Properties["UserName"].Add("myUserName");
            dirEntry.Properties["Password"].Add("myUsersPassword");
            dirEntry.CommitChanges();
            dirEntry.Close();
0
 
LVL 19

Author Closing Comment

by:elimesika
ID: 31508675
thanks for your time.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
Let's recap what we learned from yesterday's Skyport Systems webinar.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question