Move user data no USB needed!

As the title suggest this is a powershell script that allows the movement of user data from one computer to the next with no extra hardware required other than the two computers and having them connected to the same network. I came up with this while at work one day doing the long and repetitive action of imagining new laptops. I thought to myself why are we manually doing all this work. Why is it that when a employee needs an upgrade that we have to move everything with a USB there has got to be an easier way right. Well there was I just had to make it. With my father being a powershell guru and always telling me how powershell was the best scripting language out there I decided to give my hand a try to making this tool with powershell. (I personally thing python is the best scripting language but that’s a conversation for another time) The following is the code I wrote to copy the user data and send it over the network to the new computer, so when the user came to use it everything looked the same and all their stuff was there waiting for them. Note you will need to run this as admin of course:

Enable-PSRemoting
$excludes = "AppData"
$path = Read-Host -Prompt 'Input path "C:\Users\username" '
$compname = Read-Host -Prompt 'Input computer name'
Compress-Archive -Path $path -DestinationPath $path
Set-ExecutionPolicy -ExecutionPolicy Bypass -Force
$Session = New-PSSession -ComputerName $compname -Credential $credz
copy-item -Path C:\Users\*.zip* -Destination C:\Users\ -ToSession $Session