' ------------------------------------------------------------------------- ' From the book Inside Active Directory, ISBN 0-201-61621-1 ' Copyright (C) 2002 by Addison-Wesley ' Script by Sakari Kouti (see http://www.kouti.com) ' You have a royalty-free right to use, modify, reproduce and distribute ' this script (and/or any modified version) in any way you find useful, ' provided that you agree that Addison-Wesley or Sakari Kouti has no ' warranty, obligations or liability for the script. If you modify ' the script, you must retain this copyright notice. ' ------------------------------------------------------------------------- Option Explicit Const WAIT_ON_RETURN = True Const HIDE_WINDOW = 0 Call CreateHomeFolder("JackB") Sub CreateHomeFolder(strName) Dim WshShell, strPath, arrCmd(3), i Set WshShell = Wscript.CreateObject("Wscript.Shell") strPath = "d:\Users\" & strName arrCmd(0) = "cmd /c md " & strPath arrCmd(1) = "cacls " & strPath & " /e /g Administrators:F" arrCmd(2) = "cacls " & strPath & " /e /g " & strName & ":C" arrCmd(3) = "net share " & strName & "=" & strPath For i = LBound(arrCmd) To UBound(arrCmd) Call WshShell.Run(arrCmd(i), HIDE_WINDOW, WAIT_ON_RETURN) Next End Sub