Tips for Quickly Resetting File Permissions on Azure File Share

0
4
Asked By TechWiz394 On

I'm working with Windows Server and have a shared drive hosted on Azure File Share. I need to reset permissions for various files and folders under a root directory. While I initially thought of using the command `icacls \uncrootpathhere* /reset /T /C`, it turned out to be quite slow, especially given that the ACLs are stored on the file share.

To speed things up, I tried using a parallel approach with PowerShell, which improved the speed, but the process still took over 10 hours mainly due to the sheer number of files within the subfolders. Now I'm considering a method where I process the top-level folders one by one, then grab all child items to run `icacls` in parallel for those items. My question is: is this the best way to handle it? Will my approach of flattening the entire file structure affect performance negatively, or can you suggest a better method?

2 Answers

Answered By FileMaster99 On

If possible, try running the command directly on the machine using a drive letter like D:Share instead of the UNC path. This change could significantly speed up the reset because it's bypassing some of the network latency. It's all about reducing those long-distance reads/writes.

TechWiz394 -

Interesting! What specifically makes the drive letter approach faster?

Answered By User1234 On

It's important to consider that while your code might be correct, the speed can still be an issue depending on your setup. One suggestion is to use `Get-ChildItem -Directory -Recurse -Depth 2` first. Then, run a second loop in parallel. Just keep in mind that too many parallel threads can actually slow things down, especially with SMB across the internet. It might be worth running some tests and just letting it go overnight; resetting all permissions will naturally take time anyway.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.