I am trying to copy a user's profile from another drive to my C: drive. I have it down, but I ran into two problems that I keep banging my head against, but nothing is working for me.
$user="JohnDoe"
Copy-Item -Path "H:\$user\Contacts" -Destination C:\Users\user\Desktop\UserProfile\$user -recurse -Force
Copy-Item -Path "H:\$user\Desktop" -Destination C:\Users\user\Desktop\UserProfile\$user -recurse -Force
Copy-Item -Path "H:\$user\Documents" -Destination C:\Users\user\Desktop\UserProfile\$user -recurse -Force
Copy-Item -Path "H:\$user\Downloads" -Destination C:\Users\user\Desktop\UserProfile\$user -recurse -Force
Copy-Item -Path "H:\$user\Favorites" -Destination C:\Users\user\Desktop\UserProfile\$user -recurse -Force
Copy-Item -Path "H:\$user\Links" -Destination C:\Users\user\Desktop\UserProfile\$user -recurse -Force
Copy-Item -Path "H:\$user\Music" -Destination C:\Users\user\Desktop\UserProfile\$user -recurse -Force
Copy-Item -Path "H:\$user\Pictures" -Destination C:\Users\user\Desktop\UserProfile\$user -recurse -Force
Copy-Item -Path "H:\$user\Saved Games" -Destination C:\Users\user\Desktop\UserProfile\$user -recurse -Force
Copy-Item -Path "H:\$user\Searches" -Destination C:\Users\user\Desktop\UserProfile\$user -recurse -Force
Copy-Item -Path "H:\$user\Start Menu" -Destination C:\Users\user\Desktop\UserProfile\$user -recurse -Force
Copy-Item -Path "H:\$user\Videos" -Destination C:\Users\user\Desktop\UserProfile\$user -recurse -Force
When I ran the code, the first problem that happen is any folder that is copy first, all it's contents will be put inside the
C:\Users\user\Desktop\UserProfile\$user
In my code for instance, any contents in the "Contacts" folder from the oringial H: Drive will be copy over to C:Drive not inside the "Contacts" folder, but in the path location
C:\Users\user\Desktop\UserProfile\$user
The second problem is in all the folders $RECYCLE.BIN is created.
Some help would be appreciate it.