Solved

C# code for adding a computer to Active Directory

Posted on 2008-10-22
5
1,702 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 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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
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 …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

695 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