8/5/17

A Powershell note

How to copy the Desktop, Documents, and IE Favorites folders from an old terminal server to a new, when usernames were slightly different between the systems.

-------------------------------------------------------------

Import-Csv mylist.txt | ForEach-Object {

robocopy \\rwterminal\c$\users\$($_.Old)\Desktop c:\users\$($_.New)\Desktop /E /DCOPY:DAT
robocopy \\rwterminal\c$\users\$($_.Old)\Favorites c:\users\$($_.New)\Favorites /E /DCOPY:DAT
robocopy \\rwterminal\c$\users\$($_.Old)\Documents c:\users\$($_.New)\Documents /E /DCOPY:DAT

}

-------------------------------------------------------------

mylist.txt contained usernames like this:

New,Old
christopher,christopherb
sally,sallyh