Keine Beschreibung

EF-Robocopy-v1.4.ps1 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
  2. Start-Process PowerShell -Verb RunAs "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";
  3. exit;
  4. }
  5. function backup {
  6. $destdrive = read-host "Enter the drive letter of the destination drive and press Enter to continue."
  7. $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."
  8. 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
  9. }
  10. function folder-restore {
  11. $sourcedrive = read-host "Enter the drive letter of the source drive and press Enter to continue."
  12. $sourcefolder = read-host "Enter the name of the source folder. (Example: Lisse-Brian-10101-BL)"
  13. $restoredestdrive = read-host "Enter the drive letter of the destination drive (usually C) and press Enter to continue."
  14. 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
  15. }
  16. function image-restore {
  17. $sourcedrive = read-host "Enter the drive letter of the source drive and press Enter to continue."
  18. $restoredestdrive = read-host "Enter the drive letter of the destination drive (usually C) and press Enter to continue."
  19. 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
  20. }
  21. function restore-choice {
  22. $answer2 = read-host "Are you restoring from a robocopy backup, or a restored image?
  23. 1: Robocopy backup
  24. 2: Restored image
  25. (1/2)"
  26. if ($answer2 -eq 1) {folder-restore} else {
  27. if ($answer2 -eq 2) {image-restore}
  28. }
  29. }
  30. $answer = read-host -prompt "Are you backing up or restoring?
  31. 1: Backing up
  32. 2: Restoring
  33. (1/2)"
  34. if ($answer -eq 1) {backup} else {
  35. if ($answer -eq 2) {restore-choice}
  36. }
  37. sleep 1
  38. $PlayWav=New-Object System.Media.SoundPlayer
  39. $PlayWav.SoundLocation="C:\Windows\Media\Ring06.wav"
  40. $PlayWav.playsync()
  41. read-host "Robocopy operation complete. Press Enter to exit."

Powered by TurnKey Linux.