I am working on a new VDI infrastructure upgrade. We are upgrading from VMWare Horizon View v5.1 to v6. I inherited this mess from the previous admin.

Along with this upgrade we are moving user data away from roaming profiles to redirected profiles/persona management and to a new file server. Roaming profiles and various profile data is on Server 2008 and we are migrating to Server 2012 R2.

I am currently testing out Robocopy to migrate the different data scattered all over various servers to merge it into 1 user profile location on the new server so it is a comprehensive move for that user. In my script you can see several logical steps as I move data from certain folders into their corresponding folder, move root folders, and delete the duplicate folders.

My script is below:

REM :Copy roaming profile from old location to new location:

Robocopy \\scfile1\StaffProfiles$\WS\Individual\%username%.v2\Desktop \\pvsc-file03.kdl.net\home$\%username%\Desktop /e /copy:datso /mt:32 
Robocopy \\scfile1\StaffProfiles$\WS\Individual\%username%.v2\Downloads \\pvsc-file03.kdl.net\home$\%username%\Downloads /e /copy:datso /mt:32 
Robocopy \\scfile1\StaffProfiles$\WS\Individual\%username%.v2\Pictures \\pvsc-file03.kdl.net\home$\%username%\Pictures /e /copy:datso /mt:32 
Robocopy \\scfile1\StaffProfiles$\WS\Individual\%username%.v2\Favorites \\pvsc-file03.kdl.net\home$\%username%\Favorites /e /copy:datso /mt:32 
Robocopy \\scfile1\StaffProfiles$\WS\Individual\%username%.v2\Documents \\pvsc-file03.kdl.net\home$\%username%\Documents /e /copy:datso /mt:32 

REM :Copy home profile pictures from old location to new location:

Robocopy \\scfile1\Home\%username%\\"My Pictures" \\pvsc-file03.kdl.net\home$\%username%\Pictures /e /copy:datso /mt:32

REM :Copy home profile music and videos from old location to new persona management location:

Robocopy \\scfile1\Home\%username%\\"My Music" \\pvsc-file03.kdl.net\persona$\%username%.V2\Music /e /copy:datso /mt:32
Robocopy \\scfile1\Home\%username%\\"My Videos" \\pvsc-file03.kdl.net\persona$\%username%.V2\Videos /e /copy:datso /mt:32

REM :Copy home profile documents to new location

Robocopy \\scfile1\Home\%username%\\"My Documents" \\pvsc-file03.kdl.net\home$\%username%\Documents /e /copy:datso /mt:32

REM :Copy remaining home profile root folder from old location to new location:
Robocopy \\scfile1\Home\%username%\ \\pvsc-file03.kdl.net\home$\%username%\Documents /e /copy:datso /mt:32

REM :Delete un-needed, duplicate folders that were migrated from the above command:

RD /s /q \\pvsc-file03.kdl.net\home$\%username%\Documents\"My Music" 
RD /s /q \\pvsc-file03.kdl.net\home$\%username%\Documents\"My Videos"
RD /s /q \\pvsc-file03.kdl.net\home$\%username%\Documents\"My Pictures"
RD /s /q \\pvsc-file03.kdl.net\home$\%username%\Documents\"My Documents" 

Now the issue Im running into is when I login to the new file server as a domain admin and run the script it is substituting my currently logged on username for %username%. Is there a way around this?

  • EDIT: I think Im going to run the above file as a logon batch file and assign it to new users logging into the new VDI enviornment. This will allow their logon to create their user profiles with the correct security settings and copy their data over from folders they have access to. – telston Oct 11 '16 at 12:43

If not you would have to populate a list of users from AD or use a wildcard to get them all? or only do if date is no older than parameter in robocopy. But the logon script thing will also work fine :)

Hope you got along with it :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.