Alv45525 0 Light Poster

Hello guys,

I am working on something at work. We actually have a server whereby all the profiles of users working on citrix are stored. there is a routine work that we do to take ownership on a profile, rename the profile and copy the files of the old profile to the new one. WHen i say profile it is basically a folder with sub folders and files.

I wrote a little automation script on notepad ++ to do that but the thing is that there is no inheritance on the profiles so it is taking ownership only on the main folder and not on subfolders.

Kindly help

Find below what i wrote

:0001

set /p support=Enter your IT support username:%=%
set /p username=Enter The username:%=%

echo **************************************************
Echo * The Username set for IT Support is %support%.        *
Echo * The Username set for migration is %username%.  *
echo * It will be used throughout this session        *
echo **************************************************
pause

Echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo :: Note that you can stop the task any time by pressing ctrl+c.              ::
echo :: But then you will need to relaunch the batch file to perform other tasks  ::
echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

set dir="\\server01\profiles$"
::pushd \\server01\profiles$
echo off

::set /p username=Enter The username:%=%

if exist %dir%\%username% (

takeown /a /r /d y /f %dir%\%username%
icacls %dir%\%username% /grant %support%:F /t /q

)else (
echo ************************************
echo  Username %username% does not exist
echo ************************************
)

if exist %dir%\%username%.V2 (
takeown /a /r /d y /f %dir%\%username%.V2
icacls %dir%\%username%.V2 /grant %support%:F /t /q

)else (
echo *****************************************************
echo  There are no %username%V2 profile to take ownership
echo *****************************************************
)

pause

GOTO MENU