The System.DirectoryServices namespace provides users with the
ability to do some basic web site administration tasks programatically.
The classes in this namespace can be used with the Active Directory(AD)
service providers. These classes can accomplish common web site
administration tasks like creating, verifying, deleting and setting
properties of virtual directories on IIS programatically. This article
briefly describes what the different AD service providers are, how to
access AD through .NET and finally the code to create and delete
virtual directories on IIS.We will go through how to connect to the
default Web site, create a virtual directory, set a series of
properties on the directory, and subsequently delete the directory.