What is a good .Net library for Windows user administration?

We have a corporate intranet with HR functions. I would like to start auto-configuring new hires for example. creating Windows accounts for them, creating their home folders, setting up shares, etc. When an employee leaves the company, I would like to automatically delete their user.

I have struggled to find good links or libraries for user administration using .Net 2.0.

I'm ready to write ADSI code, or even WMI code, but I need to use the example code to start the process.

0


source to share


1 answer


I found the following example Code project showing how to add a new user using DirectoryServices :

private void AddUser(string strDoamin, string strLogin, string strPwd)
{
  DirectoryEntry obDirEntry = null;
  try
  {
    obDirEntry = new DirectoryEntry("WinNT://" + strDoamin);
    DirectoryEntries entries = obDirEntry.Children;
    DirectoryEntry obUser = entries.Add(strLogin, "User");
    obUser.Properties["FullName"].Add("Amigo");
    object obRet = obUser.Invoke("SetPassword", strPwd);
    obUser.CommitChanges();
  }
  catch (Exception ex)
  {
    Trace.Warn(ex.Message);
  }
}

      



But the real breakthrough came through me, signing up for Safari Books Online and opening a book called .NET Developer's Guide for Programming Directory Services - ISBN 10: 0-321-35017-0; ISBN 13: 978-0-321-35017-6

This book seems tailor-made for my dilemma, as it explains all the basics of programmatic directory services and then gives concrete examples for adding users, setting permissions, etc.

0


source







All Articles