|
@@ -0,0 +1,55 @@
|
|
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
|
+
|
|
6
|
+function backup {
|
|
7
|
+ $destdrive = read-host "Enter the drive letter of the destination drive and press Enter to continue."
|
|
8
|
+ $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."
|
|
9
|
+ 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
|
|
10
|
+}
|
|
11
|
+
|
|
12
|
+function folder-restore {
|
|
13
|
+ $sourcedrive = read-host "Enter the drive letter of the source drive and press Enter to continue."
|
|
14
|
+ $sourcefolder = read-host "Enter the name of the source folder. (Example: Lisse-Brian-10101-BL)"
|
|
15
|
+ $restoredestdrive = read-host "Enter the drive letter of the destination drive (usually C) and press Enter to continue."
|
|
16
|
+ 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
|
|
17
|
+}
|
|
18
|
+
|
|
19
|
+function image-restore {
|
|
20
|
+ $sourcedrive = read-host "Enter the drive letter of the source drive and press Enter to continue."
|
|
21
|
+ $restoredestdrive = read-host "Enter the drive letter of the destination drive (usually C) and press Enter to continue."
|
|
22
|
+ 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
|
|
23
|
+}
|
|
24
|
+
|
|
25
|
+function restore-choice {
|
|
26
|
+ $answer2 = read-host "Are you restoring from a robocopy backup, or a restored image?
|
|
27
|
+1: Robocopy backup
|
|
28
|
+2: Restored image
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+(1/2)"
|
|
33
|
+ if ($answer2 -eq 1) {folder-restore} else {
|
|
34
|
+ if ($answer2 -eq 2) {image-restore}
|
|
35
|
+ }
|
|
36
|
+ }
|
|
37
|
+
|
|
38
|
+$answer = read-host -prompt "Are you backing up or restoring?
|
|
39
|
+1: Backing up
|
|
40
|
+2: Restoring
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+(1/2)"
|
|
45
|
+
|
|
46
|
+ if ($answer -eq 1) {backup} else {
|
|
47
|
+ if ($answer -eq 2) {restore-choice}
|
|
48
|
+ }
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+sleep 1
|
|
52
|
+$PlayWav=New-Object System.Media.SoundPlayer
|
|
53
|
+$PlayWav.SoundLocation="C:\Windows\Media\Ring06.wav"
|
|
54
|
+$PlayWav.playsync()
|
|
55
|
+read-host "Robocopy operation complete. Press Enter to exit."
|