if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Start-Process PowerShell -Verb RunAs "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`""; exit; } function backup { $destdrive = read-host "Enter the drive letter of the destination drive and press Enter to continue." $destfolder = read-host "Enter the name and CC# of the customer followed by your initials, in the format Last-First-00000-AA, and press Enter to continue." ROBOCOPY C:\Users ${destdrive}:\${destfolder}\Users /E /COPY:DAT /DCOPY:DAT /XO /XJ /FP /ZB /ETA /XD "*Cache*" "*Code Cache*" "*cache2*" "*D3DSCache*" "*NVIDIACorp*" "*Spotify*" "*CacheStorage*" "*wpnidm*" "*FileHistory*" "*PrimeVideo*" "*Netflix_*" "*MobileSync*" "*CrashReporter*" /XF "*.dll" "*.bin" "*.LOGGZ" /W:1 /R:2 } function folder-restore { $sourcedrive = read-host "Enter the drive letter of the source drive and press Enter to continue." $sourcefolder = read-host "Enter the name of the source folder. (Example: Lisse-Brian-10101-BL)" $restoredestdrive = read-host "Enter the drive letter of the destination drive (usually C) and press Enter to continue." ROBOCOPY ${sourcedrive}:${sourcefolder}\Users ${restoredestdrive}:\OldDrv\Users /E /COPY:DAT /DCOPY:DAT /XO /XJ /FP /ZB /ETA /XD "*Cache*" "*Code Cache*" "*cache2*" "*D3DSCache*" "*NVIDIACorp*" "*Spotify*" "*CacheStorage*" "*wpnidm*" "*FileHistory*" "*PrimeVideo*" "*Netflix_*" "*MobileSync*" "*CrashReporter*" /XF "*.dll" "*.bin" "*.LOGGZ" /W:1 /R:2 } function image-restore { $sourcedrive = read-host "Enter the drive letter of the source drive and press Enter to continue." $restoredestdrive = read-host "Enter the drive letter of the destination drive (usually C) and press Enter to continue." ROBOCOPY ${sourcedrive}:\Users ${restoredestdrive}:\OldDrv\Users /E /COPY:DAT /DCOPY:DAT /XO /XJ /FP /ZB /ETA /XD "*Cache*" "*Code Cache*" "*cache2*" "*D3DSCache*" "*NVIDIACorp*" "*Spotify*" "*CacheStorage*" "*wpnidm*" "*FileHistory*" "*PrimeVideo*" "*Netflix_*" "*MobileSync*" "*CrashReporter*" /XF "*.dll" "*.bin" "*.LOGGZ" /W:1 /R:2 } function restore-choice { $answer2 = read-host "Are you restoring from a robocopy backup, or a restored image? 1: Robocopy backup 2: Restored image (1/2)" if ($answer2 -eq 1) {folder-restore} else { if ($answer2 -eq 2) {image-restore} } } $answer = read-host -prompt "Are you backing up or restoring? 1: Backing up 2: Restoring (1/2)" if ($answer -eq 1) {backup} else { if ($answer -eq 2) {restore-choice} } sleep 1 $PlayWav=New-Object System.Media.SoundPlayer $PlayWav.SoundLocation="C:\Windows\Media\Ring06.wav" $PlayWav.playsync() read-host "Robocopy operation complete. Press Enter to exit."