+ Post New Thread
Results 1 to 4 of 4
Scripts Thread, Set ownership and permissions of homefolders - ICalcs and TAKEOWN in Coding and Web Development; I'm not much of a script writer at all, I currently have Code: set /p userDir= Username: TAKEOWN /f "C:\Home ...
  1. #1
    bondbill2k2's Avatar
    Join Date
    Jan 2011
    Location
    West Midlands
    Posts
    1,013
    Thank Post
    80
    Thanked 66 Times in 51 Posts
    Blog Entries
    2
    Rep Power
    42

    Set ownership and permissions of homefolders - ICalcs and TAKEOWN

    I'm not much of a script writer at all, I currently have
    Code:
    set /p userDir=   Username:
    
    
    
    TAKEOWN /f "C:\Home Directories\%userDir%" /r /d y
    ICACLS "C:\Home Directories\%userDir%" /reset /T
    ICACLS "C:\Home Directories\%userDir%" /grant:r "SERVERNAME\%userDir%":(OI)(CI)M
    ICACLS "C:\Home Directories\%userDir%" /setowner "SERVERNAME\%userDir%" /T
    This works perfect for a single folder at a time, entering the username when prompted but I'd like to run this on a whole year of students, the idea is simple count the number of directories in the location specified. For each dir get the dir name and change the userdir parameter to this for each loop until all have been changed. I'm sure this wouldn't take long for someone who knows the syntax better then me I'll give it a go myself but might be beaten on here by other users, you beautifully brainy bunch!

  2. #2

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,330
    Thank Post
    622
    Thanked 1,578 Times in 1,415 Posts
    Rep Power
    413
    What about feeding it dir/b as the input variable?

    Ben

  3. #3

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,330
    Thank Post
    622
    Thanked 1,578 Times in 1,415 Posts
    Rep Power
    413
    Or to make doubly sure it's only directories that are returned.

    Code:
    dir /A:D /B
    Ben

  4. #4

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,330
    Thank Post
    622
    Thanked 1,578 Times in 1,415 Posts
    Rep Power
    413
    Code:
    FOR /F "tokens=*" %%z IN ('dir /A:D /B "Path_goes_here"') DO (echo change perms %%z)
    For a start.

    Ben

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 4
    Last Post: 3rd August 2010, 11:05 AM
  2. Export list of shares and permissions?
    By cookie_monster in forum Windows Server 2008
    Replies: 4
    Last Post: 13th July 2010, 08:16 AM
  3. Replies: 5
    Last Post: 17th October 2008, 03:34 PM
  4. Ownership and Permissions
    By TechSupp in forum How do you do....it?
    Replies: 2
    Last Post: 5th October 2007, 10:38 PM
  5. Replies: 3
    Last Post: 9th September 2006, 08:13 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •