Results 1 to 4 of 4

Thread: Problem After Creating Home Folder with vbs script

  1. #1
    Join Date
    Jan 2005
    Posts
    34

    Problem After Creating Home Folder with vbs script

    I have created a script which automatically creates users and assign them to security groups. It also created and sets home folder. Before I post my problem, just heave a look at this script:
    'Create home folder
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFSO.CreateFolder("\\terra\home\2010\" &
    strSAMAccountName)

    'Set permissions
    Set oShell = wscript.CreateObject("Wscript.Shell")
    oShell.Run "%COMSPEC% /c Echo Y| cacls \\terra\home\2010\"&
    strSAMAccountName & " /t /e /g Administrators:F "& strSAMAccountName &
    ":C /R Students", 2, True

    'Set home directory and home drive
    objNewUser.Put "homeDirectory", "\\terra\home\2010\" &
    strSAMAccountName
    objNewUser.SetInfo
    objNewUser.Put "homeDrive", "H"
    objNewUser.SetInfo
    Now the problem am facing is don’t know why the folder does not map in the login script at first logon. However at the end of script, everything works fine as permissions are also set properly. Continuing with the problem, when any of my client user trued to access the home folder manually, Windows XP gives an error message saying ‘Disallowed.’

    I know I can fix it by going to AD users and computers and configuring the settings manually, but it is going to be hectic because we have more than 500 users and it continues every year’s beginning. So I want to know if it is possible using the script itself?

  2. #2
    Join Date
    Jul 2004
    Posts
    128

    RE: Problem After Creating Home Folder with vbs script

    I guess yoiur script itself is having some problem. If you notice, you can see it is missing a colon at ‘H:’. Just make the following changes in your script:

    objNewUser.HomeDrive = "H:"
    objNewUser.HomeDirectory = ("\\terra\home\2010\" & objNewUser.sAMAccountName)
    objNewUser.SetInfo

  3. #3
    Join Date
    Sep 2004
    Posts
    63

    Re: Problem After Creating Home Folder with vbs script

    I think you are right Lyalisai, homeDrive needs the trailing colon, "H:". Also, I assign full permissions to user. And, I specify the NetBIOS domain name as part of the trustee name. I have a very similar script where i use the following:
    intRunError = objShell.Run("%COMSPEC% /c Echo Y|
    cacls " _
    & strHomeFolder & " /T /E /C /G " &
    strNetBIOSDomain _
    & "\" & strNTName & ":F", 2, True)
    where strNetBIOSDomain is the NetBIOS name of the domain, and strNTName is the sAMAccountName.

  4. #4
    Join Date
    Jan 2005
    Posts
    34

    Re: Problem After Creating Home Folder with vbs script

    Thank you very much for the help guys. That did it.

    Help appreciated.

Similar Threads

  1. creating a script for a host file
    By mopat in forum Technology & Internet
    Replies: 1
    Last Post: 07-07-2010, 11:44 PM
  2. Creating shell script in ubuntu
    By Elizabeth Allen in forum Operating Systems
    Replies: 5
    Last Post: 24-03-2010, 01:35 PM
  3. Creating script with GREP OR ?
    By Aidan 12 in forum Operating Systems
    Replies: 4
    Last Post: 12-03-2010, 08:36 PM
  4. Home folder creation via script
    By CHRITOPHER in forum Active Directory
    Replies: 3
    Last Post: 15-12-2008, 10:39 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,713,575,817.83497 seconds with 17 queries