+ Post New Thread
Results 1 to 2 of 2
Scripts Thread, Script to alter security on same folder in multiple folders in Coding and Web Development; I need a script (pref VB) to change permissions on a folder in multiple folders. Example, imagine users home directory, ...
  1. #1
    tosca925's Avatar
    Join Date
    Aug 2005
    Location
    Midlands
    Posts
    1,565
    Thank Post
    4
    Thanked 4 Times in 4 Posts
    Rep Power
    17

    Script to alter security on same folder in multiple folders

    I need a script (pref VB) to change permissions on a folder in multiple folders.

    Example, imagine users home directory, so a folder contains all the users. Each user has a folder insiide their home driectory called 'examples'. I need a script to search for that folder inside each users home directory and change the permissios to 'read, list folder contents'

    Can this be done?

    This is not being done on users home directories but this was the best example i could give.

    Or imagine their are 10 folders named 1 to 10. inside each folder are 5 folders named A,B,C,D and E. I want a script to search for the folder named 'D' and change the permission on that folder only.

  2. IDG Tech News

  3. #2

    maniac's Avatar
    Join Date
    Feb 2007
    Location
    Kent
    Posts
    3,000
    Thank Post
    192
    Thanked 415 Times in 300 Posts
    Rep Power
    136

    Re: Script to alter security on same folder in multiple folders

    Well the there's a vbs version of xcacls which will let you modify NTFS permissions. I use it to modify local directory permissions on workstations at machine start up.

    As for it looking for all folders named 'D' in a directory tree, It can't do that itself, but it's a start.

    Link http://support.microsoft.com/kb/825751


    Mike.

    Edit:

    Cobbled together this bit of code which examines the directory tree under the specified directory, it then compares the all the folder and subfolder names to the specified folder name. If it finds a match it then calls the XCACLS.VBS script using the full folder path and the specified options. I've not tested this, so it may need some tweaking. I know the directory search bit works, just the line that calls XCACLS might need some adjusting.

    Code:
    Set objShell = CreateObject("WScript.Shell")
    Set FSO = CreateObject("Scripting.FileSystemObject")
    
    ShowSubfolders FSO.GetFolder("C:\SPECIFY\START\FOLDER")
    
    Sub ShowSubFolders(Folder)
        For Each Subfolder in Folder.SubFolders
            if Subfolder.Name = "FOLDERNAME" then 
    	runline = "c:\xcacls.vbs " & subfolder.Path & " /E /G etc. etc."
    	objShell.Run runline
    	End if
            ShowSubFolders Subfolder
        Next
    End Sub
    Hope that helps,

    Mike.

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 15
    Last Post: 19th September 2007, 10:46 PM
  2. VB Script to create folders
    By markesmith in forum Scripts
    Replies: 2
    Last Post: 26th April 2007, 03:03 PM
  3. Folder Security
    By Grommit in forum Windows
    Replies: 7
    Last Post: 25th September 2006, 03:32 PM
  4. Script to Create My Documents Subject Folders
    By SwedishChef in forum Scripts
    Replies: 15
    Last Post: 5th July 2006, 08:14 AM

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
  •