I am currently migrating from a Unix FS to a Windows FS and i need to copy user folders. I have created a robocopy script that is very simple with a few kinks here and there.
My script:
@echo off set /p username=Enter Username to start copying files: echo %username% takeown /f \UNIXFS\users$%username%* /r /D N timeout /t 3 robocopy \UNIXFS\users$%username% \WINDOWSFS\Production$%username% /S /E /B /Z /ZB /MT:64 /V /TEE /ETA /TS /R:5 /W:1 /BYTES /X /DEBUG /LOG:C:\Robocopy%username%.log timeout /t 3 icacls \WINDOWSFS\Production$%username%* /grant:r domain%username%:(OI)(CI)F /T pause
I have an input section asking me which user i would like to start copying files from and too.
i take owner ship from the user as the current domain admin, copy the files and give the user full permissions on the folder.
But the ownership is still for the domain admin and not the user chosen by the inputted user.
Therefor i have created a separate single command line bat file that will take the ownership of the folder when i log in to the users account.
Take ownership script to run on for the migrated user: takeown /F \WindowsFS\Production$%username%* /r /D Y
is there a way i can combine these two script as one and just run this as a single script.
I have tried to just combine them both together but the last takeown command like just give the user that runs the script ownership, when you have to do this for a lot of users you don't want to manually input or run the takeown script one by one on all machines.