Results 1 to 4 of 4

Thread: Home folder creation via script

  1. #1
    Join Date
    Aug 2005
    Posts
    13

    Home folder creation via script

    I would like to generate a users home folder via a script rather than doing it through ADUC/properties, can anyone tell me how to do that? Actually, I have a file server that is full of users home folders, but with no permissions. When I resetup their home folder using \\servername\share$\%username% then it will overqrite the permissions and keep the data. I want to do this on mass, for around 1000's of users. Thanks.

  2. #2
    Join Date
    Aug 2005
    Posts
    822

    RE: Home folder creation via script

    Have you tried Google CACLS which is a command line tool that can be used to change permissions on folders. Check the below script to bulk create folders for all users in a certrain OU and set their user account to have Full Control. You can try to use it, which will give you some hints:

    Option Explicit

    Dim objFSO
    Dim objShell
    Dim objNewFolder
    Dim strPath
    Dim intShell
    Dim objUsers
    Dim objUser
    Dim strUserName

    Set objUsers = GetObject _
    ("LDAP://ou=UserOU, dc=domain, dc=com")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objShell = CreateObject("WScript.Shell")

    objUsers.Filter("User")

    For Each User in objUsers, check the below one:

    strUserName = objUser.SAMAccountName
    strPath = "F:\USER\" & strUserName
    Set objNewFolder = objFSO.CreateFolder(strPath)
    intShell = objShell.Run("%COMSPEC% /k cacls " & strPath & " /E /G DOMAIN\"
    & strUserName & ":F")
    Next

  3. #3
    Join Date
    Aug 2005
    Posts
    13

    RE: Home folder creation via script

    Thanks, I have checked that path, but what I want to do is to replicate the process that takes place when doing this in AD. The reason for this is that some users dont have Home Folders, and I want both to create folders for these users en mass, and recreate the permissions on all other folders.

  4. #4
    Join Date
    Aug 2006
    Posts
    201
    Until I am missing something that you can do this with something similard to the script give, you can just try to add some code to check if the folder already exists. If it can then just run the CACLS command to set the permissions. If it cannot then create the folder and then set the permissions.

Similar Threads

  1. Modify file or folder creation date
    By Abode in forum Portable Devices
    Replies: 4
    Last Post: 24-09-2010, 07:35 AM
  2. Problem of user creation or folder sharing
    By KALYAN23 in forum Operating Systems
    Replies: 3
    Last Post: 16-10-2009, 10:29 PM
  3. Replies: 5
    Last Post: 27-01-2009, 07:45 PM
  4. Problem After Creating Home Folder with vbs script
    By Susan Bradley in forum Active Directory
    Replies: 3
    Last Post: 18-08-2008, 09:33 PM
  5. Modify Permission to Home Folder Script
    By Masti in forum Windows Server Help
    Replies: 1
    Last Post: 23-04-2008, 08:15 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,018,531.67322 seconds with 17 queries