Solved

C# code for adding a computer to Active Directory

Posted on 2008-10-22
5
1,649 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
  • 2
  • 2
5 Comments
 
LVL 8

Assisted Solution

by:mikainz
mikainz earned 50 total points
Comment Utility
0
 
LVL 15

Assisted Solution

by:angus_young_acdc
angus_young_acdc earned 450 total points
Comment Utility
0
 
LVL 19

Author Comment

by:elimesika
Comment Utility
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 450 total points
Comment Utility
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
Comment Utility
thanks for your time.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction You may have a need to setup a group of users to allow local administrative access on workstations.  In a domain environment this can easily be achieved with Restricted Groups and Group Policies. This article will demonstrate how to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now