home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 29 / XENIATGM29.iso / ie / ie40pp1 / ie4 / wsh.cab / makeou.vbs < prev    next >
Text File  |  1996-10-21  |  2KB  |  59 lines

  1. ' Windows Script Host Sample Script
  2. '
  3. ' ------------------------------------------------------------------------
  4. '               Copyright (C) 1996 Microsoft Corporation
  5. '
  6. ' You have a royalty-free right to use, modify, reproduce and distribute
  7. ' the Sample Application Files (and/or any modified version) in any way
  8. ' you find useful, provided that you agree that Microsoft has no warranty,
  9. ' obligations or liability for any Sample Application Files.
  10. ' ------------------------------------------------------------------------
  11. '
  12. 'This is a VB Script that adds an OU to the specified directory path
  13.  
  14.  
  15. dim o
  16. dim con
  17. dim oArgs
  18. dim newou
  19. dim newuser
  20. dim Style
  21. dim Title
  22. dim CRLF
  23.  
  24. CRLF = Chr(13) & Chr(10)
  25.  
  26. set oArgs = WScript.Arguments
  27.  
  28. If oArgs.Count < 2 Then
  29.        Style = vbOKOnly     ' Define buttons.
  30.        Title = "Usage"      ' Define title.
  31.  
  32.        Response = MsgBox("Adds an organization unit via OLE DS" & CRLF & CRLF & _
  33.        "Usage:" & CRLF & CRLF & _
  34.        "     makeou.vbs location ou " & CRLF & CRLF & _
  35.        "location = DS path" & CRLF & _
  36.        "ou       = Organizational unit you want to add." & CRLF, _
  37.         Style, Title)
  38.     
  39.        'stop script
  40.        WScript.Quit(1)
  41. End If
  42.  
  43. set con = WScript.GetObject("LDAP:/"+oArgs.Item(0))
  44. 'WScript.Echo oArgs.Item(0)
  45. 'WScript.Echo con.name
  46. 'WScript.Echo con.oledspath
  47.  
  48. 'Make a new ou
  49. 'WScript.Echo oArgs.Item(1)
  50.  
  51. set newou = con.create("organizationalUnit","OU="+oArgs.Item(1))
  52. 'WScript.Echo newou.oledspath
  53.  
  54. newou.put "cn",oArgs.item(1)
  55. newou.put "description","created from VBS!"
  56. newou.setinfo
  57.  
  58. ' Done
  59. WScript.Echo newou.name+" created."