After some troubles with copied user home folders during a migration, the rights were set incorrectly.
As this was about more than just a handful of users, re-setting the rights manually wasn’t a good idea.
After digging around on the net, I adjusted a script so that this could be done automagically.
@echo off setlocal set fold="*" set fold=%fold:"=% for /F "tokens=*" %%i in ('dir "%1" /b /ad') do call :UPERM "%%i" endlocal goto end: :UPERM set user=%1 set user=%user:"=% echo %user% icacls %user% /grant "%user%":(OI)(CI)(M,RX,R,W,D) :end
The approach on this is that the user home folder is the same as the username.
The list of directories is taken from the working directory. The subfolders that are put into a variable are the user home folders.
The script then walks through them all and sets (OI)(CI)(M,RX,R,W,D) rights using icacls, so that the users are able to get to their files again.
Look up the icacls help on setting the rights, if you want to adjust the script.
Have fun, hope this helps you.