Solved

C# code for adding a computer to Active Directory

Posted on 2008-10-22
5
1,668 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
ID: 22774867
0
 
LVL 15

Assisted Solution

by:angus_young_acdc
angus_young_acdc earned 450 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 450 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Mapping Drives using Group policy preferences Are you still using old scripts to map your network drives if so this article will show you how to get away for old scripts and move toward Group Policy Preference for mapping them. First things f…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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 from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
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…

776 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