create folder structure on file server for each user...with permission if possible

Author Message
foler

  • Total Posts : 1
  • Scores: 0
  • Reward points : 0
  • Joined: 1/31/2012
  • Status: offline
create folder structure on file server for each user...with permission if possible Tuesday, January 31, 2012 12:42 AM (permalink)
0
hello...
I need to make folder structure for each user in domain. Structure is like:
c:\test\barack obama
c:\test\barack obama\inbox
c:\test\barack obama\personal
 
I have script which make folders for each user in active directory domain (bellow) but need to update this script to make subfolders inbox and personal. If possible, at same time to grant user permission ownership and full control to root, and for inbox share and everyone access to this share. Root folder "barack obama" without any inheritance to c:\....
 
script which make folders for each user in active directory domain to folder c:\test:
On Error Resume Next
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT displayName, sn FROM 'LDAP://DC=sk,DC=local' WHERE objectCategory='user'"
Set objRecordSet = objCommand.Execute
Set objFSO = CreateObject("Scripting.FileSystemObject")
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
strInitial = Left (objRecordSet.Fields("displayName").Value, 100)
strFolderName = "C:\test\" & strInitial
Set objFolder = objFSO.CreateFolder(strFolderName)
objRecordSet.MoveNext
Loop
 
thanks
 
#1
    dm_4ever

    • Total Posts : 3687
    • Scores: 82
    • Reward points : 0
    • Joined: 6/29/2006
    • Location: Orange County, California
    • Status: offline
    Re:create folder structure on file server for each user...with permission if possible Tuesday, January 31, 2012 3:25 AM (permalink)
    0
    The function ebgreen shows here would help you make subdirectories easily:
     
    http://www.visualbasicscript.com/fb.ashx?m=38936
     
    For permissions you can probably use subinacl by calling it with WScript.Shell and its Run method:
    http://www.microsoft.com/...aylang=en&id=23510
    dm_4ever

    My philosophy: K.I.S.S - Keep It Simple Stupid
    Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
    Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9