Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi
I downloaded the VBscript file to create folders for my users in AD, but I am not a VBS programmer, can anybody help me in changing it so I can use a specific OU to create the folders. At the moment it creates the whole domain. Here is the script from Microsoft Q234746Sub GetParentDir
ParentDir = InputBox("Type the path of the parent folder for the user folders:", "Parent Directory Input Prompt", ParentDir)
If Not FS.FolderExists(ParentDir) Then
GetParentDir
End If
End SubDim WSHNetwork, WSHShell, FS, Domain, DomainObj, Computer, ShareServiceObj, ParentDir, Hidden, Drive
Set FS = CreateObject("Scripting.FileSystemObject")
Set WSHNetwork = CreateObject("WScript.Network")
Set ShareServiceObj = GetObject("WinNT://" & WSHNetwork.ComputerName & "/LanManServer")Domain = InputBox("Type the name of your domain:","Enumeration and Creation of User Shares","DomainName")
ParentDir = "C:\Users"
GetParentDir
Hidden = MsgBox("Do you want the user shares to be hidden? If yes, the share will be username$; If no, the share will be username", 4, "Hidden Shares?")
Hidden = Hidden - 7
Drive = InputBox("What drive letter do you want to map the home folder to?", "Drive Letter?", "X:")
Set DomainObj = GetObject("WinNT://" & Domain)
DomainObj.Filter = Array("User")For Each UserObj in DomainObj
Dim ShareName
If Not FS.FolderExists(ParentDir & "\" & UserObj.Name) Then
FS.CreateFolder(ParentDir & "\" & UserObj.Name)
End If
ShareName = UserObj.Name
If Hidden Then
ShareName = ShareName & "$"
End If
On Error Resume Next
Set NewShare = ShareServiceObj.Create("fileshare", ShareName)
If Not Err Then
NewShare.Path = ParentDir & "\" & UserObj.Name
NewShare.MaxUserCount = 1 'Sets the limit for the number of user connections
NewShare.SetInfo
UserObj.HomeDirectory = "\\" & WSHNetwork.ComputerName & "\" & ShareName
UserObj.HomeDirDrive = Drive 'Requires ADSI 2.5
UserObj.SetInfo
End If
NextMsgBox "Script Complete",, "Finished"
By the way the script doesn't actually share the folders out in Windows 2003, it just create them, even though it ask me to shared them with a hidden $.
Thanks
Ken

Hi
It's for a server. eg. Windows 2003 server.
OU is Organization unit.
I have created one for my users,
Ken

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |