home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples.exe / QuickStart / howto / doc / adwrite.aspx < prev    next >
Encoding:
Text File  |  2000-06-09  |  3.9 KB  |  82 lines

  1.  
  2. <!-- #include virtual="/quickstart/howto/include/header.inc" -->
  3.  
  4. <h4>How Do I...Modify Active Directory?</h4>
  5.  
  6. <div class="indent" style="width:660">
  7. <p class="MsoNormal"><font face="Tahoma" size="1">Active Directory Service
  8. Interfaces (ADSI) accesses the capabilities of directory services from different
  9. network providers in a distributed computing environment, to present a single
  10. set of directory service interfaces for managing network resources.
  11. Administrators and developers can use ADSI services to enumerate and manage the
  12. resources in a directory service, no matter which network environment contains
  13. the resource. Use Active Directory to perform common administrative tasks, such
  14. as adding new users and managing printers throughout the distributed computing
  15. environment.</font><font face="Tahoma" size="1"><o:p>
  16. </o:p>
  17. </font></p>
  18. <p class="MsoNormal"><font face="Tahoma" size="1">This sample illustrates how to
  19. 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
  20. a small console application that can be run from a command prompt. The
  21. application takes three command line arguments. The first argument has to be a
  22. valid path to an active directory entry.<O:P>
  23.  The second one is a property name of the entry. The third one is the new value
  24. of the entry.</O:P>
  25. </span></p>
  26. <p class="Text"><span style="FONT-SIZE: 8pt; FONT-FAMILY: Tahoma; mso-bidi-font-size: 10.0pt">Try
  27. running the following command substituting the path and property name for a
  28. valid Active Directory path for your particular network:<O:P>
  29.  </O:P>
  30. </span></p>
  31. <p class="MsoNormal" style="MARGIN-LEFT: 0.5in"><font face="Courier New" size="2"><span style="COLOR: blue; mso-bidi-font-size: 12.0pt">>
  32. ADWrite.exe "LDAP://DC=Microsoft,DC=COM" "name"
  33. "Microsoft"</span></font></p>
  34. <p class="MsoNormal"><font face="Tahoma" size="1">In its simplest form, writing
  35. to the Active Directory involves:</font></p>
  36. <p class="MsoNormal"><font face="Tahoma" size="1">1. </font><font face="Tahoma" size="1">Creating
  37. a new DirectoryEntry:</font></p>
  38. <blockquote>
  39.   <p class="MsoNormal"><span style="mso-bidi-font-size: 12.0pt"><font face="Courier New" color="#0000FF" size="2">DirectoryEntry
  40.   objDirEnt=new DirectoryEntry(args[0]);</font><font face="Tahoma" size="1"><o:p>
  41.   </o:p>
  42.   </font></span></p>
  43. </blockquote>
  44. <p><font face="Tahoma" size="1">2. Setting the DirectoryEntry objectÆs
  45. properties:</font></p>
  46. <blockquote>
  47.   <p class="MsoNormal"><span style="mso-bidi-font-size: 12.0pt"><font face="Courier New" size="2" color="#0000FF">objDirEnt.Properties[args[1]].Value
  48.   = args[2];</font><font face="Tahoma" size="1"><o:p>
  49.   </o:p>
  50.   </font></span></p>
  51. </blockquote>
  52. <p><font face="Tahoma" size="1">3. Co</font><font face="Tahoma" size="1">mmitting
  53. the changes to the Active Directory:</font></p>
  54. <blockquote>
  55.   <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>
  56.   </o:p>
  57.   </span></p>
  58. </blockquote>
  59.  
  60. </div>
  61.  
  62. <h4>Example</h4>
  63.  
  64. <p>
  65. <div class="indent">
  66. <a target="_blank" href="/quickstart/howto/samples/Services/DirectoryServices/ADWrite">
  67. <img style="border-color:black" border=1 src="/quickstart/images/genicon.gif"><br>
  68. </a>
  69. <div class="caption">ADWrite.exe</div><br>
  70. [<a target="_blank" href="/quickstart/howto/samples/Services/DirectoryServices/ADWrite">View Sample</a>] | 
  71. [<a target="_blank" href="/quickstart/util/srcview.aspx?path=/quickstart/howto/samples/Services/DirectoryServices/ADWrite/ADWrite.src">View Source</a>]<p>
  72. </div>
  73.  
  74. <h4>Source Code</h4>
  75.  
  76. <div class="code">
  77. <xmp>
  78. <!-- #include virtual="/quickstart/howto/samples/Services/DirectoryServices/ADWrite/ADWrite.cs" -->
  79. </xmp>
  80. </div>
  81.  
  82. <!-- #include virtual="/quickstart/howto/include/footer.inc" -->