1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

user cant write to homefolder.

Discussion in 'Web Design, HTML And CSS' started by Daniel.Laursen, Nov 8, 2010.

  1. Daniel.Laursen

    Daniel.Laursen New Member

    Joined:
    Nov 8, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hey guys.

    we have a bit of a brainer here.

    my firm is setting up a whole new network to replace the old one, and we are adding users through a VBscript and in that script we create and give permissions and all that. thats all nice, the users are created, a homefolder is created, but the permissions doesnt seem to work. if we manually go into the user setup in the AD and sets a path for the homefolder it creates it perfectly with the correct rights and all. but in the script is seems that something goes wrong cause

    1. The script says: Unable to set permission for "username" BUT it does it anyway cause the user is listed in the security list with full rights, though there is another "user" called "account unknown" followed by a whole bunch of numbers.

    2. when i go into a user account and run the "net use" command it finds the networkdrive and connects to the homefolder but the user cant write to the drive. he can see whats the folder contain but cant execute anything even though he owns the folder, has full rights and all. the domain administrator can read, write and delete in the very same folder but i cant find the diffrence in the security settings between the admin and the user.

    ---------------------------------------------------------------
    This is the snip of the script. Everything else works.
    ---------------------------------------------------------------
    I not to sure whether the parameters are correct. I've been reading through xcalcs to find the right settings and search the net endlessly to find
    somebody else to do the dirty work, but I can't seem to find a script that do just this. (Most of this code is from the web though).

    If I change the /E to /T I end up only with this wierd looking user, but im interested in editing the ACL instead of removing it.
    If i add Administrator :F to the string, nothing happens if the /T parameter is set (strDirectory & " /T /C /G Administrator :F " &). Maybe I misunderstood something here?

    strUser is always the relevant user logon name.

    Code:
    'Here goes
    strDirectory = "\\drive\folder\..\" & strUser  
     
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set oFSO = CreateObject("Scripting.FileSystemObject")
     
    ' Create a shell for cmd and CACLS
    Set objShell = CreateObject("Wscript.Shell")
     
    
    ' --------------------------------------------------
    ' Defines permissions on folder
    ' --------------------------------------------------
     
    objFSO.CreateFolder(strDirectory)
    
    'Assign user permission to home folder.               
    intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " _
      & strDirectory & " /E /C /G " & strUser & ":F", 2, True)
    Wscript.Echo "Error assigning permissions for user " _
      & strUser & " to home folder " & strDirectory
                     
      On Error GoTo 0
     On Error GoTo 0
    End If
     
    Last edited by a moderator: Nov 8, 2010
  2. tairjam

    tairjam New Member

    Joined:
    Apr 25, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Daniel,

    Did you ever get a response to this? I'm trying something similar.
     

Share This Page