home *** CD-ROM | disk | FTP | other *** search
-
- <!-- #include virtual="/quickstart/howto/include/header.inc" -->
-
- <h4>How Do I...Modify Active Directory?</h4>
-
- <div class="indent" style="width:660">
- <p class="MsoNormal"><font face="Tahoma" size="1">Active Directory Service
- Interfaces (ADSI) accesses the capabilities of directory services from different
- network providers in a distributed computing environment, to present a single
- set of directory service interfaces for managing network resources.
- Administrators and developers can use ADSI services to enumerate and manage the
- resources in a directory service, no matter which network environment contains
- the resource. Use Active Directory to perform common administrative tasks, such
- as adding new users and managing printers throughout the distributed computing
- environment.</font><font face="Tahoma" size="1"><o:p>
- </o:p>
- </font></p>
- <p class="MsoNormal"><font face="Tahoma" size="1">This sample illustrates how to
- change a value of a property of an Active Directory entry.</font><span style="FONT-SIZE: 8pt; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.0pt">It's
- a small console application that can be run from a command prompt. The
- application takes three command line arguments. The first argument has to be a
- valid path to an active directory entry.<O:P>
- The second one is a property name of the entry. The third one is the new value
- of the entry.</O:P>
- </span></p>
- <p class="Text"><span style="FONT-SIZE: 8pt; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.0pt">Try
- running the following command substituting the path and property name for a
- valid Active Directory path for your particular network:<O:P>
- </O:P>
- </span></p>
- <p class="MsoNormal" style="MARGIN-LEFT: 0.5in"><font face="Courier New" size="2"><span style="COLOR: blue; mso-bidi-font-size: 12.0pt">>
- ADWrite.exe "LDAP://DC=Microsoft,DC=COM" "name"
- "Microsoft"</span></font></p>
- <p class="MsoNormal"><font face="Tahoma" size="1">In its simplest form, writing
- to the Active Directory involves:</font></p>
- <p class="MsoNormal"><font face="Tahoma" size="1">1. </font><font face="Tahoma" size="1">Creating
- a new DirectoryEntry:</font></p>
- <blockquote>
- <p class="MsoNormal"><span style="mso-bidi-font-size: 12.0pt"><font face="Courier New" color="#0000FF" size="2">DirectoryEntry
- objDirEnt=new DirectoryEntry(args[0]);</font><font face="Tahoma" size="1"><o:p>
- </o:p>
- </font></span></p>
- </blockquote>
- <p><font face="Tahoma" size="1">2. Setting the DirectoryEntry objectÆs
- properties:</font></p>
- <blockquote>
- <p class="MsoNormal"><span style="mso-bidi-font-size: 12.0pt"><font face="Courier New" size="2" color="#0000FF">objDirEnt.Properties[args[1]].Value
- = args[2];</font><font face="Tahoma" size="1"><o:p>
- </o:p>
- </font></span></p>
- </blockquote>
- <p><font face="Tahoma" size="1">3. Co</font><font face="Tahoma" size="1">mmitting
- the changes to the Active Directory:</font></p>
- <blockquote>
- <p class="MsoNormal"><span style="mso-bidi-font-size: 12.0pt"><font face="Courier" size="2" color="#0000FF">objDirEnt.CommitChanges();</font></span><span style="font-size:8.0pt;mso-bidi-font-size:12.0pt"><o:p>
- </o:p>
- </span></p>
- </blockquote>
-
- </div>
-
- <h4>Example</h4>
-
- <p>
- <div class="indent">
- <a target="_blank" href="/quickstart/howto/samples/Services/DirectoryServices/ADWrite">
- <img style="border-color:black" border=1 src="/quickstart/images/genicon.gif"><br>
- </a>
- <div class="caption">ADWrite.exe</div><br>
- [<a target="_blank" href="/quickstart/howto/samples/Services/DirectoryServices/ADWrite">View Sample</a>] |
- [<a target="_blank" href="/quickstart/util/srcview.aspx?path=/quickstart/howto/samples/Services/DirectoryServices/ADWrite/ADWrite.src">View Source</a>]<p>
- </div>
-
- <h4>Source Code</h4>
-
- <div class="code">
- <xmp>
- <!-- #include virtual="/quickstart/howto/samples/Services/DirectoryServices/ADWrite/ADWrite.cs" -->
- </xmp>
- </div>
-
- <!-- #include virtual="/quickstart/howto/include/footer.inc" -->