I have several hundred folders that all contain a sub-folder named "Bid Documents".
I need to change the ACL permissions on every instance of those "Bid Documents" folders.
Is there a way to automate this process? I've been told that vbscript is not a good choice for dealing with ACL permissions. I'm imagining a powershell script or something similar that will automatically search the entire folder hierarchy and add the specified ACL permission to every folder named "proposal", but I don't know if this is actually possible, or if there is some other way to accomplish this task.
Thoughts anyone?
Edit: The comment box keeps messing up my actual powershell command whcih should be as follows:
Get-ChildItem "e:\datastore\marcstone bids\*\*\*\Bid Documents" | where {$_.Attributes -eq 'Directory'}
The problem is that sometimes the Proposals folder is not always three layers under Marcstone bids, but sometimes only two layers, so when I try the following:
Get-ChildItem "e:\datastore\marcstone bids\*\*\Bid Documents" | where {$_.Attributes -eq 'Directory'}
Notice how the second version has only two * This version fails to find any folders though there are many. Why?
Edit again: This keeps getting more interesting. Upon examining the results returned by the successful command I discovered it only returns "Bid Documents" folders that are empty. Any "Bid Documents" folders containing any files at all are not returned. Why??
Edit again: I changed the command to the following and it returned ALL the "bid documents" folders.
Get-ChildItem "e:\datastore\marcstone bids\*\*\*\Bid Documents" | where {$_.Attributes -match 'Directory'}
Now to learn how to use icacls to change the permissions.
Edit again: OK, I think I have the correct syntax for icacls with this:
icacls *filename* /deny special-restrict1:(f)
So, PLEASE someone help me connect these two commands together.
Experimenting with a variable like this:
$var = Get-ChildItem "e:\datastore\marcstone bids\1001-3500\1701-1750\1702 Morrow M
emorial Home - Sparta WI\Bid Documents" | where {$_.Attributes -match 'Directory'} | icacls $var /deny special-restrict1
:/F
I've selected a specific folder for experimentation purposes. The command returns the following error:
First parameter must be a file name pattern or "/?"
Thoughts anyone?
No comments:
Post a Comment