I have created a batch script that adjusts folder ownership and permissions. The script recursively cycles through all subfolders names of a folder. The names of the folders are usernames. The script assigns folder ownership and full permissions to the that user. Ie. If the folder name is "JBloggs", then Jbloggs will be made the owner and be granted full permission.
There is one folder I do not want the script to touch. This folder is called "default"
I've added an IF then NEQ statement so if it encounters a folder with the name "default" it will just skip over it, but it doesn't seem to be working.
Any advice would be greatly appreciated!
CD /D "D:\Public\Users\"
FOR /D %%A IN (*) DO (
IF %%A NEQ "default" THEN (
REM TAKEOWN /F "%%A" /A /R /D Y
REM ICACLS "%%A" /RESET /T
REM ICACLS "%%A" /GRANT:R "DOMAIN\%%A:(OI)(CI)F"
REM ICACLS "%%A" /SETOWNER "DOMAIN\%%A" /T
ECHO %%A >> C:\Public\Scripts\Log.txt