forked from SwiftOnSecurity/OfficeDeployFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOfficeDeploy.bat
1647 lines (1283 loc) · 62.1 KB
/
OfficeDeploy.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
REM start file - buffer line
:: OfficeDeployFramework
:: Original work by @SwiftOnSecurity https://github.com/SwiftOnSecurity/OfficeDeployFramework
:: Advanced multi-product, multi-generation Microsoft Office installation orchestration with in-depth options and performance optimization for any scenario
:: Supports MSI editions of Office 2007 through Office 2016. Supports removing existing Click-To-Run products
:: Supports retreiving files interally via UNC and publicly via encrypted packages hosted on HTTPS
:: Works both interactively and via command line arguments for deployment via SCCM
:: Gradually built over the period of two years for a very specific combination of requirements in a real enterprise network with roaming users, both with and without admin.
SETLOCAL ENABLEDELAYEDEXPANSION
@echo on
set "EchoMode=echo"
set "debug="
title Microsoft Office installer %1 %3
set Version=65
set ScriptDate=2018-03-26
:: [Downloads/caches/loads directly] installation files for Office suites, then installs them
:: Operates over HTTPS or UNC
:: Also performs cleanup and maintenance tasks to increase system performance
:: Sanity check to prevent clearing root of drive
if not defined Temp exit
if not defined LocalAppData exit
if /I "%TEMP%"=="" exit
if /I "%TEMP%"=="\" exit
if /I "%TEMP%"=="C:" exit
if /I "%TEMP%"=="C:\" exit
if /I "%TEMP%"=="C:\Windows" exit
if /I "%TEMP%"=="D:\" exit
if /I "%TEMP%"=="E:\" exit
if /I "%TEMP%"=="F:\" exit
:: Set variables
Set "local=%~dp0"
Set "LocalDir=C:\install\OfficeDeploy"
md "%LocalDir%"
Set "Log=%LocalDir%\log.txt"
Set "LogClean=%LocalDir%\logclean.txt"
echo !date! !time!- LOG START >>%log%
:: POSITION 1 - Installation source type (UNC or HTTPS or Liveload)
set "Protocol=%1"
echo Flag - Protocol: %Protocol% >>%log%
:: POSITION 2 - Installation source server (UNC only)
set "SourceServer=%2"
echo Flag - SourceServer: %SourceServer% >>%log%
:: POSITION 3 - Deliverable suite (#)
set "InstallType=%3"
echo Flag - InstallType: %InstallType% >>%log%
:: POSITION 4 - Password to decrypt packages (none to purposely skip, or leave blank for default)
if not "%4"=="" (
if not "%4"=="none" (
set "PackagePassword=%4"
echo Flag - Password: Included >>%log%
)
)
if not defined PackagePassword (
set "PackagePassword=%USERDOMAIN%"
echo Flag - Password: Set natively >>%log%
)
:: POSITION 5 - Enable jumping to local script file after choices and caching (jump to engage, or none)
set "LocalJump=%5"
echo Flag - Jump: %LocalJump% >>%log%
if "%LocalJump%"=="jump" (
echo ALERT - JUMPING >>%log%
goto Jump
)
:: POSITION 6 - Restrict if Office is already installed (restrict or none)
set "Restrict=%6"
echo Flag - Restrict: %Restrict% >>%log%
:: POSITION 7 - Note if script pushed onto machine, reboot at end (reboot or none)
if "%7"=="reboot" (
set "reboot=reboot"
echo Flag - Reboot: %reboot% >>%log%
)
:: Set 32-bit kludge to change 32-bit installs to use 32-bit binaries in some cases
if not defined ProgramFiles(x86) set "32=32"
:: ------------------
:Select-Protocol
:: Choose which transfer and caching method to use for files
:: Show user interface if not passed through command line
if not defined Protocol (
echo =====Protocol=====
echo 1 = HTTPS
echo 2 = UNC
echo 3 = Liveload
echo.
set /p ProtocolNumber=Enter your selection:
:: Take user entry and translate to protocol string
if "!ProtocolNumber!"=="1" set Protocol=HTTPS
if "!ProtocolNumber!"=="2" set Protocol=UNC
if "!ProtocolNumber!"=="3" set Protocol=Liveload
)
:: Redo title
title Microsoft Office installer %Protocol% %3
:: Return to start of section if user entry invalid
if not defined Protocol goto Select-Protocol
:: Log
echo Protocol: %Protocol% >>%log%
:Select-Protocol-End
:: ------------------
:Select-SourceServer
:: Choose which internal server to use, if applicable
:: Skip if protocol is HTTPS
REM if "%Protocol%"=="HTTPS" goto Select-SourceServer-End
:: Show user interface if not passed through command line
if not defined SourceServer (
echo =====SourceServer=====
echo 1 = SERVER0
echo 2 = SERVER1
echo 3 = SERVER2
echo 4 = SERVER3
echo.
set /p SourceServerNumber=Enter your selection:
:: Take user entry and translate to protocol string
if "!SourceServerNumber!"=="1" set "SourceServer=\\server0\MicrosoftOffice\OfficeDeploy"
if "!SourceServerNumber!"=="2" set "SourceServer=\\server1\MicrosoftOffice\OfficeDeploy"
if "!SourceServerNumber!"=="3" set "SourceServer=\\server2\MicrosoftOffice\OfficeDeploy"
if "!SourceServerNumber!"=="4" set "SourceServer=\\server3\MicrosoftOffice\OfficeDeploy"
)
:: Return to start of section if user entry invalid
if not defined SourceServer goto Select-SourceServer-End
:: Log
echo SourceServer: %SourceServer% >>%log%
%debug%
:Select-SourceServer-End
:: ------------------
:Select-InstallType
:: Choose which software to install
:: Show user interface if not passed through command line
if not defined InstallType (
echo =====InstallType=====
echo 1 = Office 2016 Standard x86
echo 2 = Outlook 2016 x86
echo 3 = Office 2007 + Outlook 2016 x86 + Full purge
echo 4 = Office 2013 Pro Plus x86
echo 5 = Office 2007 + Outlook 2016 + Access 2016 + Full purge
echo 6 = Hollow install
echo 7 = Office 2007 + Outlook 2016 + Access 2016 + Full purge
echo 8 = Retrofit Access 2016
echo 9 = Office 2016 + Access 2016 + Full purge
echo.
set /p InstallType=Enter your selection:
)
:: Log
echo InstallType: %InstallType% >>%log%
:: ------------------
:Select-Restriction
:: Skip install if Restrict parameter is passed and Office already installed
if "%Restrict%"=="restrict" (
:: Check Office 2010
if exist "C:\Program Files (x86)\Microsoft Office\Office14\Outlook.exe" (
:: Catch if script resumed from wrong position
if not "%Restrict%"=="restrict" goto Select-Protocol
echo Restricted - Office2010 detected >>%log%
goto Error-Restricted
)
:: Check Office 2013
if exist "C:\Program Files (x86)\Microsoft Office\Office15\Outlook.exe" (
:: Catch if script resumed from wrong position
if not "%Restrict%"=="restrict" goto Select-Protocol
echo Restricted - Office2013 detected >>%log%
goto Error-Restricted
)
:: Check Office 2016
if exist "C:\Program Files (x86)\Microsoft Office\Office16\Outlook.exe" (
:: Catch if script resumed from wrong position
if not "%Restrict%"=="restrict" goto Select-Protocol
echo Restricted - Office2016 detected >>%log%
goto Error-Restricted
)
)
:: ------------------
:UpdateLogic
:: Retrieve core bootstrap files from UNC server if specified and cache locally
robocopy "%SourceServer%" "%LocalDir%" /R:0 /FFT /LEV:1 /XF *.exe && goto UpdateLogic-End
:UpdateLogic-End
:UpdateUtil
robocopy "%SourceServer%\util" "%LocalDir%\util" /R:0 /FFT /LEV:1
:UpdateUtil-End
%debug%
:: ------------------
:: Jumping to local script instead of continuing in network script
echo !date! !time! JUMPING - %LocalDir%\installoffice2016.bat %Protocol% %SourceServer% %InstallType% -x- jump >>%log%
%LocalDir%\installoffice2016.bat %Protocol% %SourceServer% %InstallType% %PackagePassword% jump
exit
:Jump
echo !date! !time!- JUMP SUCCESSFUL >>%log%
title Microsoft Office installer %1 %3
:: ------------------
:: Office 2016 Standard - subflags
if "%InstallType%"=="1" (
echo !date! !time!- Office 2016 variables loading >>%log%
set "Exclude=UpdateOffice2007.7z Office2007ProPlus.7z Office2013ProPlusx86.7z UpdateOffice2013.7z Outlook2016x86.7z NvidiaMobileDriver.7z"
set "EDITIONS=STANDARD,BASIC,PRO,AccessRuntime,Proof,HomeAndStudent,Enterprise,ProfessionalHybrid,Personal,Ultimate,CLICK2RUN,SmallBusiness,Groove,Outlook,EXPDFXPS,ProPlus,VISVIEW,ACCESSRT,LYNCENTRY,CLIENTSUITES,PIA /Quiet /Log %LOCALDIR%"
set "wipe-2007=1"
set "wipe-2010=0"
set "wipe-2013=0"
set "wipe-2016=1"
set "wipe-c2r=1"
set "clear-2007exe=1"
set "clear-ost=1"
set "install-Office2007=0"
set "install-Access2007=0"
set "skip-patch2007=0"
set "install-Office2013PP=0"
set "install-Office2016Std=1"
set "install-Outlook2016=0"
set "install-Access2016=0"
set "install-Access2016Runtime=1"
set "install-SkypeForBusiness2016Basic=1"
set "install-Visio2016Viewer=1"
)
:: Outlook 2016 - subflags
if "%InstallType%"=="2" (
echo !date! !time!- Outlook 2016 variables loading >>%log%
set "Exclude=Access2016Runtime.7z UpdateOffice2007.7z Office2007ProPlus.7z Office2013ProPlusx86.7z UpdateOffice2013.7z Office2016Standardx86.7z NvidiaMobileDriver.7z"
set "EDITIONS=STANDARD,BASIC,PRO,AccessRuntime,Proof,HomeAndStudent,Enterprise,ProfessionalHybrid,Personal,Ultimate,CLICK2RUN,SmallBusiness,Groove,Outlook,EXPDFXPS,ProPlus,VISVIEW,ACCESSRT,LYNCENTRY,CLIENTSUITES,PIA /Quiet /Log %LOCALDIR%"
set "wipe-2007=0"
set "wipe-2010=0"
set "wipe-2013=0"
set "wipe-2016=1"
set "wipe-c2r=1"
set "clear-2007exe=0"
set "clear-ost=1"
set "install-Office2007=0"
set "install-Access2007=0"
set "skip-patch2007=0"
set "install-Office2013PP=0"
set "install-Office2016Std=0"
set "install-Outlook2016=1"
set "install-Access2016=0"
set "install-Access2016Runtime=1"
set "install-SkypeForBusiness2016Basic=1"
set "install-Visio2016Viewer=1"
)
:: Office 2007 + Outlook 2016 x86 + Full purge - subflags
if "%InstallType%"=="3" (
echo !date! !time!- Office 2007 + Outlook 2016 x86 + Full purge variables loading >>%log%
set "Exclude=Access2016Runtime.7z Office2013ProPlusx86.7z UpdateOffice2013.7z Office2016Standardx86.7z NvidiaMobileDriver.7z"
set "EDITIONS=ALL /Quiet /Log %LOCALDIR%"
set "wipe-2007=1"
set "wipe-2010=1"
set "wipe-2013=1"
set "wipe-2016=1"
set "wipe-c2r=1"
set "clear-2007exe=0"
set "clear-ost=1"
set "install-Office2007=1"
set "install-Access2007=0"
set "skip-patch2007=0"
set "install-Office2013PP=0"
set "install-Office2016Std=0"
set "install-Outlook2016=1"
set "install-Access2016=0"
set "install-Access2016Runtime=1"
set "install-SkypeForBusiness2016Basic=1"
set "install-Visio2016Viewer=1"
)
:: Office 2013 - subflags
if "%InstallType%"=="4" (
echo !date! !time!- Office 2013 variables loading >>%log%
set "Exclude=Access2016Runtime.7z UpdateOffice2007.7z Office2007ProPlus.7z Office2016Standardx86.7z Outlook2016x86.7z UpdateOffice2016.7z NvidiaMobileDriver.7z"
set "EDITIONS=STANDARD,BASIC,PRO,AccessRuntime,Proof,HomeAndStudent,Enterprise,ProfessionalHybrid,Personal,Ultimate,CLICK2RUN,SmallBusiness,Groove,Outlook,EXPDFXPS,ProPlus,VISVIEW,ACCESSRT,LYNCENTRY,CLIENTSUITES,PIA /Quiet /Log %LOCALDIR%"
set "wipe-2007=1"
set "wipe-2010=0"
set "wipe-2013=0"
set "wipe-2016=1"
set "wipe-c2r=1"
set "clear-2007exe=1"
set "clear-ost=1"
set "install-Office2007=0"
set "install-Access2007=0"
set "skip-patch2007=0"
set "install-Office2013PP=1"
set "install-Office2016Std=0"
set "install-Outlook2016=0"
set "install-Access2016=0"
set "install-Access2016Runtime=0"
set "install-SkypeForBusiness2016Basic=1"
set "install-Visio2016Viewer=1"
)
:: Office 2007 + Outlook 2016 + Access 2016 + Full purge
if "%InstallType%"=="5" (
echo !date! !time!- Office 2007 + Outlook 2016 + Access 2016 variables loading >>%log%
set "Exclude=Access2016Runtime.7z Office2013ProPlusx86.7z UpdateOffice2013.7z Office2016Standardx86.7z Outlook2016x86.7z NvidiaMobileDriver.7z"
set "EDITIONS=STANDARD,BASIC,PRO,AccessRuntime,Proof,HomeAndStudent,Enterprise,ProfessionalHybrid,Personal,Ultimate,CLICK2RUN,SmallBusiness,Groove,Outlook,CLIENTSUITES,PIA /Quiet /Log %LOCALDIR%"
set "wipe-2007=1"
set "wipe-2010=1"
set "wipe-2013=1"
set "wipe-2016=1"
set "wipe-c2r=1"
set "clear-2007exe=0"
set "clear-ost=0"
set "install-Office2007=1"
set "install-Access2007=0"
set "skip-patch2007=0"
set "install-Office2013PP=0"
set "install-Office2016Std=0"
set "install-Outlook2016=1"
set "install-Access2016=1"
set "install-Access2016Runtime=0"
set "install-SkypeForBusiness2016Basic=1"
set "install-Visio2016Viewer=1"
)
:: Hollow install - subflags
if "%InstallType%"=="6" (
echo !date! !time!- Hollow install variables loading >>%log%
set "Exclude=Access2016Runtime.7z NvidiaMobileDriver.7z Office2007ProPlus.7z Office2013ProPlusx86.7z UpdateOffice2013.7z Office2016Standardx86.7z Outlook2016x86.7z UpdateOffice2007.7z UpdateOffice2013.7z UpdateOffice2016.7z "
set "EDITIONS=/Quiet /Log %LOCALDIR%"
set "wipe-2007=0"
set "wipe-2010=0"
set "wipe-2013=0"
set "wipe-2016=0"
set "wipe-c2r=1"
set "clear-2007exe=0"
set "clear-ost=0"
set "install-Office2007=0"
set "install-Access2007=0"
set "skip-patch2007=0"
set "install-Office2013PP=0"
set "install-Office2016Std=0"
set "install-Outlook2016=0"
set "install-Access2016=0"
set "install-Access2016Runtime=0"
set "install-SkypeForBusiness2016Basic=1"
set "install-Visio2016Viewer=1"
)
:: Office 2007 + Outlook 2016 + Access 2016 + Full purge - subflags
if "%InstallType%"=="7" (
echo !date! !time!- Office 2007 + Outlook 2016 + Access 2016 + Full purge >>%log%
set "Exclude=A2016.7z O2013PPSP1x86.7z UO2013.7z O2016Sx86.7z NVMOBILE.7z"
set "EDITIONS=ALL /Quiet /Log %LOCALDIR%"
set "wipe-2007=1"
set "wipe-2010=1"
set "wipe-2013=1"
set "wipe-2016=1"
set "wipe-c2r=1"
set "clear-2007exe=1"
set "clear-ost=0"
set "install-Office2007=1"
set "install-Access2007=0"
set "skip-patch2007=0"
set "install-Office2013PP=0"
set "install-Office2016Std=0"
set "install-Outlook2016=1"
set "install-Access2016=1"
set "skip-patch2016=0"
set "install-Access2016Runtime=0"
set "install-SkypeForBusiness2016Basic=1"
set "install-Visio2016Viewer=1"
)
:: Retrofit Access 2016
if "%InstallType%"=="8" (
echo !date! !time!- Retrofit Access 2016 x86 variables loading >>%log%
set "Exclude=Access2016Runtime.7z Office2013ProPlusx86.7z UpdateOffice2013.7z Office2016Standardx86.7z NvidiaMobileDriver.7z"
set "EDITIONS=ACCESS,ACCESSRT,AccessRuntime /Quiet /Log %LOCALDIR%"
set "wipe-2007=0"
set "wipe-2010=0"
set "wipe-2013=0"
set "wipe-2016=0"
set "wipe-c2r=1"
set "clear-2007exe=0"
set "clear-ost=0"
set "install-Office2007=0"
set "install-Access2007=0"
set "skip-patch2007=1"
set "install-Office2013PP=0"
set "install-Office2016Std=0"
set "install-Outlook2016=0"
set "install-Access2016=1"
set "skip-patch2016=1"
set "skip-aux=1"
set "install-Access2016Runtime=0"
set "install-SkypeForBusiness2016Basic=0"
set "install-Visio2016Viewer=0"
del "%LocalDir%\Packages\*.*" /f /s /q >>%logclean%
)
:: Office 2016 + Access 2016 + Full purge
if "%InstallType%"=="9" (
echo !date! !time!- Office 2016 + Access 2016 + Full Purge variables loading >>%log%
set "Exclude=Access2016Runtime.7z Office2013ProPlusx86.7z UpdateOffice2013.7z Office2016Standardx86.7z NvidiaMobileDriver.7z"
set "EDITIONS=ALL /Quiet /Log %LOCALDIR%"
set "wipe-2007=1"
set "wipe-2010=1"
set "wipe-2013=1"
set "wipe-2016=1"
set "wipe-c2r=1"
set "clear-2007exe=1"
set "clear-ost=0"
set "install-Office2007=0"
set "install-Access2007=0"
set "skip-patch2007=1"
set "install-Office2013PP=0"
set "install-Office2016Std=1"
set "install-Outlook2016=0"
set "install-Access2016=1"
set "skip-aux=0"
set "install-Access2016Runtime=0"
set "install-SkypeForBusiness2016Basic=1"
set "install-Visio2016Viewer=1"
)
:: ------------------
:: Activate Windows if not already completed
start "" "cscript.exe" "c:\windows\system32\slmgr.vbs" /ato
:: Log
echo !date! !time!- Activate Windows triggered >>%log%
:: ------------------
:: Prevent sleep or screensaver until reboot
taskkill /im "caffeine.exe" /f
start "" /b "%LocalDir%\util\caffeine.exe" -noicon
:: ------------------
:: Log computer information
WMIC path Win32_ComputerSystem >> "%LocalDir%\model.txt"
start /b WMIC path Win32_BIOS Get Name >> "%LocalDir%\bios.txt"
start /b WMIC path Win32_PnPEntity Get Name >> "%LocalDir%\hardware.txt"
start /b WMIC path Win32_Product Get Name >> "%LocalDir%\software.txt"
start /b wmic bios get serialnumber >> "%LocalDir%\model.txt"
type "%LocalDir%\model.txt" | FIND "Dell"
if !ERRORLEVEL! == 0 set HWOEM=Dell
type "%LocalDir%\model.txt" | FIND "E6430"
if !ERRORLEVEL! == 0 set HWMODEL=E6430
if !ERRORLEVEL! == 0 set VIDEO=NVMOBILE
type "%LocalDir%\model.txt" | FIND "E6420"
if !ERRORLEVEL! == 0 set HWMODEL=E6420
if !ERRORLEVEL! == 0 set VIDEO=NVMOBILE
:: ------------------
:CLEAN-BEGIN
:: Close Office
FOR %%g IN (outlook,lync,ucmapi,msosync,msouc,msoev,msotd,communicator,searchfilterhost,searchindexer,officeclicktorun,lynchtmlconv,iastoricon,iastordatasvc,iastora,iastorv,ocpubmgr) DO (taskkill /IM %%g.exe /T /F >>%log%)
:: Re-register MSIEXEC, in case it's corrupt
start "" /b /wait "msiexec.exe" /regserver
if "%skip-aux%"=="1" goto CLEAN-END
:: ------------------
:: ------------------
:: ----CLEANING-----
:: Log
echo !date! !time!- Begin cleaning, see %logclean% >>%log%
:: Clear unused profiles to free disk space and MFT
start "" /b /wait "%LocalDir%\util\delprof2.exe" /d:45 /u >>%logclean%
:: ------------------
:: Clear OST
if "%clear-ost%"=="1" (
del /q /f /s "C:\Users\*.ost" >>%logclean%
for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Local\Microsoft\Outlook\*.ost" >>%logclean%
)
for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Outlook" >>%logclean%
:: ------------------
:: Clear temp files in user profile and Windows directory
del /q /f "C:\Windows\*.log" >>%logclean%
del "%TEMP%\*.*" /f /s /q >>%logclean%
rd /S /Q "%TEMP%\" >>%logclean%
md "%TEMP%" >>%logclean%
del "C:\Windows\Temp\*.*" /f /s /q >>%logclean%
rd /S /Q "C:\Windows\Temp\" >>%logclean%
del "C:\$RECYCLE.BIN\*.*" /f /s /q >>%logclean%
rd /S /Q "C:\$RECYCLE.BIN\" >>%logclean%
:: ------------------
:: Remove all user temp files
for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Temp\*.*" >>%logclean%
for /d %%a in (C:\Users\*) do rd /S /Q "%%a\AppData\Local\Temp\*.*" >>%logclean%
:: ------------------
:: Clear Office caches
for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Roaming\Microsoft\Templates\Normal*" >>%logclean%
for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Office\16.0\*.*" >>%logclean%
for /d %%a in (C:\Users\*) do RD /s /q "%%a\AppData\Local\Microsoft\Office\16.0" >>%logclean%
for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\microsoft\forms\*.*" >>%logclean%
for /d %%a in (C:\Users\*) do RD /s /q "%%a\AppData\Local\microsoft\forms" >>%logclean%
for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Outlook\16\*.*" >>%logclean%
for /d %%a in (C:\Users\*) do RD /s /q "%%a\AppData\Local\Microsoft\Outlook\16" >>%logclean%
for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Outlook\gliding\*.*" >>%logclean%
for /d %%a in (C:\Users\*) do RD /s /q "%%a\AppData\Local\Microsoft\Outlook\gliding" >>%logclean%
for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Outlook\Offline Address Books\*.*" >>%logclean%
for /d %%a in (C:\Users\*) do RD /s /q "%%a\AppData\Local\Microsoft\Outlook\Offline Address Books" >>%logclean%
for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Outlook\RoamCache\*.*" >>%logclean%
for /d %%a in (C:\Users\*) do RD /s /q "%%a\AppData\Local\Microsoft\Outlook\RoamCache" >>%logclean%
for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Local\Microsoft\Outlook\*.dat" >>%logclean%
for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Local\Microsoft\Outlook\*.oab" >>%logclean%
for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Local\Microsoft\Outlook\*.obi" >>%logclean%
for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Local\Microsoft\Outlook\*.xml" >>%logclean%
for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Local\Microsoft\Office\16.0\*.*" >>%logclean%
for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Roaming\Microsoft\Outlook\*.dat" >>%logclean%
for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Roaming\Microsoft\Outlook\*.srs" >>%logclean%
for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Roaming\Microsoft\Outlook\*.xml" >>%logclean%
:: ------------------
:: Clear Temporary Internet Files
for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\*.*" >>%logclean%
for /d %%a in (C:\Users\*) do RD /s /q "%%a\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\" >>%logclean%
for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.MSO\*.*" >>%logclean%
for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\*.*" >>%logclean%
for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Word\*.*" >>%logclean%
for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Windows\Tempor~1\*.*" >>%logclean%
for /d %%a in (C:\Users\*) do RD /s /q "%%a\AppData\Local\Microsoft\Windows\Tempor~1" >>%logclean%
for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Internet Explorer\Recovery\*.*" >>%logclean%
for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Windows\INetCache\IE\*.*" >>%logclean%
start "" /b /wait RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8
:: ----------------------
:: Clear Windows 10 upgrade files
del /q /f "C:\$WINDOWS.~BT\*.*" >>%logclean%
rd /S /Q "C:\$WINDOWS.~BT\" >>%logclean%
:: ------------------
:: Clear unneeded files in root of drive
attrib -h -s "C:\WinPEpge.sys" >>%logclean%
del "C:\WinPEpge.sys" /f >>%logclean%
del /f /s /q "C:\$Recycle.Bin\" >>%logclean%
rd /s /q "C:\$Recycle.Bin\" >>%logclean%
del /f /s /q "C:\hotfix\*.*" >>%logclean%
rd /s /q "C:\hotfix\" >>%logclean%
del /f /s /q "C:\intel\*.*" >>%logclean%
rd /s /q "C:\intel\" >>%logclean%
del /f /s /q "C:\logs\*.*" >>%logclean%
rd /s /q "C:\logs\" >>%logclean%
:: ------------------
:: Clear old Volume Shadow Copies
start "" /b /wait "net.exe" start VSS >>%logclean%
start "" /b /wait "vssadmin.exe" delete shadows /for=%SystemDrive% /oldest /quiet >>%logclean%
:: ------------------
:: Clean Windows
del "C:\Windows\Logs\CBS\*.*" /f /s /q >>%logclean%
reg import "%LocalDir%\cleanmgr.reg"
::start "" /b /wait "cleanmgr.exe" /sagerun:1337 /verylowdisk
:CLEAN-END
:: ------------------
:: ----DOWNLOADS-----
:: Log
echo !date! !time!- Jumping to Protocol %protocol% >>%log%
:: Jump to protocol we'll be using
goto %Protocol%
:: ------------------
:HTTPS
::Set InstallDir to the same as LocalDir
set "InstallDir=%LocalDir%"
:: Log
echo !date! !time!- HTTPS download started >>%log%
::Setup wget
::Preload KeyCDN certificate in system store with BITSADMIN download
:: Set random number
set "Rand=%RANDOM%"
start "" /wait "bitsadmin.exe" /transfer KeyCDN%rand% /PRIORITY FOREGROUND /download "https://filestore.kxcdn.com/" "%TEMP%\tempfile%rand%"
:: --UNIVERSAL--
echo !date! !time!- HTTPS Universal download starting >>%log%
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/DellBios.7z
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/MSFT_EMET.7z
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/JunkReporter.7z
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/OneDrive.7z
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/VisioViewer2016.7z
:: --HARDWARE--
::Intel
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/IntelChipset.7z
::Dell
if "%HWOEM%"=="Dell" (
echo !date! !time!- HTTPS Dell download starting >>%log%
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/DellCommandUpdate.7z
)
::E6430
if "%VIDEO%"=="NVMOBILE" (
echo !date! !time!- HTTPS nVidia mobile download starting >>%log%
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/NvidiaMobileDriver.7z
)
:: --Office 2007 Pro Plus x86--
if "%install-Office2007%"=="1" (
:: Download Office2007 Pro Plus x86
echo !date! !time!- HTTPS Office 2007 download starting >>%log%
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/Office2007ProPlus.7z
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/UpdateOffice2007.7z
)
:: --Office 2013 ProPlus SP1 x86--
if "%install-Office2013PP%"=="1" (
:: Download Office2013 ProPlus SP1 x86
echo !date! !time!- HTTPS Office 2013 download starting >>%log%
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/Office2013ProPlusx86.7z
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/UpdateOffice2013.7z
)
:: --Access 2016 x86--
if "%install-Access2016%"=="1" (
:: Download Access2016 Runtime
echo !date! !time!- HTTPS Access 2016 x86 download starting >>%log%
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/Access2016.7z
)
:: --Access 2016 Runtime x86--
if "%install-Access2016Runtime%"=="1" (
:: Download Access2016 Runtime
echo !date! !time!- HTTPS Access Runtime x86 download starting >>%log%
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/Access2016Runtime.7z
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/UpdateOffice2016.7z
)
:: --Skype for Business 2016 Basic x86--
if "%install-SkypeForBusiness2016Basic%"=="1" (
:: Download Skype for Business 2016 Basic
echo !date! !time!- HTTPS S4B download starting >>%log%
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/SkypeForBusiness2016.7z
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/UpdateOffice2016.7z
)
:: --Office 2016 Std x86--
if "%install-Office2016Std%"=="1" (
:: Download Office 2016 Standard
echo !date! !time!- HTTPS Office2016 download starting >>%log%
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/Office2016Standardx86.7z
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/UpdateOffice2016.7z
)
:: --Outlook 2016 x86--
if "%install-Outlook2016%"=="1" (
:: Download Outlook 2016
echo !date! !time!- HTTPS Outlook2016 download starting >>%log%
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/Outlook2016x86.7z
start "" /b /wait "%LocalDir%\util\wget!32!.exe" --continue --no-cache --no-if-modified-since -N -P "%LocalDir%\Packages\\" https://filestore.kxcdn.com/UpdateOffice2016.7z
)
goto Protocol-End
:: ------------------
title Microsoft Office installer %1 %3
:: ------------------
:UNC
:: Log
echo !date! !time!- Begin UNC copy >>%log%
::Set InstallDir to the same as LocalDir
set "InstallDir=%LocalDir%"
start "" /b /wait "robocopy" "%SourceServer%\packages" "%LocalDir%\packages\\" /MIR /FFT /Z /R:1 /XF %Exclude%
echo !date! !time!- Robocopy errorlevel: !ERRORLEVEL! >>%log%
if "%VIDEO%"=="NVMOBILE" (
echo !date! !time!- Copying NVMOBILE >>%log%
start "" /b /wait "xcopy" "%SourceServer%\packages\NvidiaMobileDriver.7z" "%LocalDir%\packages"
)
goto Protocol-End
:: ------------------
:Liveload
:: Log
echo !date! !time!- Liveload - no copy needed >>%log%
::Set InstallDir to the server
set "InstallDir=%SourceServer%"
goto Protocol-End
:: ------------------
:Protocol-End
:: Log
echo !date! !time!- End of downloads >>%log%
:: ------------------
:: ----EXTRACTION-----
:: Log
echo !date! !time!- Extracting >>%log%
cd "%LOCALDIR%\Packages"
for /F "delims=:" %%A IN ('dir /b %LOCALDIR%\Packages\*.7z') DO (
start "" /b /wait "%LocalDir%\util\7za.exe" -p%PackagePassword% -y x %%A
echo !date! !time!- Extraction errorlevel: !ERRORLEVEL! >>%log%
)
cd "%LOCALDIR%
:: ------------------
:: Log
echo !date! !time!- Closing programs >>%log%
:: Close Office
FOR %%g IN (winword,outlook,powerpnt,mspub,msaccess,excel,lync,ucmapi,msosync,msouc,msoev,msotd,vpreview,groove,onenote,onenotem,firefox,chrome,communicator,makecab,searchfilterhost,searchindexer,faxctrl,officeclicktorun,lynchtmlconv,iexplore,dropbox,iastoricon,iastordatasvc,iastora,iastorv,sfdcmsol,ocpubmgr,skype) DO (taskkill /IM %%g.exe /T /F >>%log%)
:: ------------------
:CONFIG-BEGIN
if "%skip-aux%"=="1" goto CONFIG-END
:: ------------------
:: Log
echo !date! !time!- Disabling telemetry1 >>%log%
:: DisableProgramTelemetry1
schtasks /change /TN "\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" /DISABLE
schtasks /change /TN "\Microsoft\Windows\Application Experience\ProgramDataUpdater" /DISABLE
schtasks /change /TN "\Microsoft\Windows\Application Experience\StartupAppTask" /DISABLE
schtasks /change /TN "\Microsoft\Windows\Application Experience\AitAgent" /DISABLE
schtasks /change /TN "\Microsoft\Windows\WindowsBackup\ConfigNotification" /DISABLE
schtasks /change /TN "\Microsoft\Windows\RemoteAssistance\RemoteAssistanceTask" /DISABLE
wevtutil sl AirSpaceChannel /e:false
wevtutil cl AirSpaceChannel
reg add "HKCU\Software\Policies\Microsoft\Windows\AppCompat" /v DisablePCA /t REG_DWORD /d 1 /f
reg add "HKLM\Software\Policies\Microsoft\Windows\AppCompat" /v DisableUAR /t REG_DWORD /d 1 /f
reg add "HKLM\Software\Policies\Microsoft\Windows\AppCompat" /v AITEnable /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience/Program-Telemetry" /v Enabled /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience/Program-Compatibility-Assistant" /v Enabled /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience/Program-Compatibility-Troubleshooter" /v Enabled /t REG_DWORD /d 0 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience/Program-Inventory" /v Enabled /t REG_DWORD /d 0 /f
:: ------------------
:: Log
echo !date! !time!- Resetting Windows Search >>%log%
:: Reset Windows Search
sc config WSearch start= disabled >>%log%
net stop WSearch >>%log%
reg.exe delete "HKLM\Software\Microsoft\Windows Search" /v SetupCompletedSuccessfully /f >>%log%
RD /S /Q "C:\ProgramData\Microsoft\Search" >>%logclean%
:: ------------------
:: Log
echo !date! !time!- Stopping Windows Update >>%log%
:: Clean Windows Update
sc config wuauserv start= disabled >>%log%
net stop wuauserv >>%log%
if exist "%windir%\softwaredistribution\download" rmdir /s /q "%windir%\softwaredistribution\download"
:: ------------------
:: Log
echo !date! !time!- Stopping C2R >>%log%
:: Stop Click2Run
sc config ClickToRunSvc start= disabled >>%log%
net stop ClickToRunSvc >>%log%
schtasks /change /TN "\Microsoft\Office\Office Automatic Updates" /DISABLE >>%log%
:: ------------------
:: Log
echo !date! !time!- Removing C2R and Telemetry >>%log%
:: Remove Office C2R and Telemetry
if exist "C:\Program Files (x86)\Common Files\Microsoft Shared\ClickToRun\OfficeClickToRun.exe" start "" /b /wait "C:\Program Files (x86)\Common Files\Microsoft Shared\ClickToRun\OfficeClickToRun.exe" scenario=install scenariosubtype=ARP sourcetype=None productstoremove=SkypeforBusinessEntryRetail.16_en-us_x-none culture=en-us version.16=16.0 DisplayLevel=false
if exist "C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeClickToRun.exe" start "" /b /wait "C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeClickToRun.exe" scenario=install scenariosubtype=ARP sourcetype=None productstoremove=SkypeforBusinessEntryRetail.16_en-us_x-none culture=en-us version.16=16.0 DisplayLevel=false
:: Remove Office C2R Extensibility
start "" /b /wait "MsiExec.exe" /X{90160000-008C-0000-0000-0000000FF1CE} /qn /norestart
start "" /b /wait "MsiExec.exe" /X{90160000-008F-0000-1000-0000000FF1CE} /qn /norestart
start "" /b /wait "MsiExec.exe" /X{90160000-008C-0409-0000-0000000FF1CE} /qn /norestart
start "" /b /wait "MsiExec.exe" /X{90160000-00DD-0000-1000-0000000FF1CE} /qn /norestart
:: Remove Telemetery
start "" /b /wait "MsiExec.exe" /X{90160000-0132-0409-1000-0000000FF1CE} /qn /norestart
:: Force-remove
WMIC product where "Name like '%%click-to-run%%'" call uninstall /nointeractive
:: ------------------
:: Log
echo !date! !time!- Removing Salesforce >>%log%
:: Uninstall Salesforce for Outlook
taskkill /im sfdcmsol.exe /f >>%log%
FOR %%g IN ({41feb4a2-7bd2-4d2a-a260-8e8c0e78850c},{af65dc73-94a0-4e85-8ac2-dba52cad1091},{2f4f88fa-c802-4bb6-8e12-9e8313625475},{115EDFAD-1AFB-46A6-9252-43FBB8186D5A},{80EBD79F-5DE4-4189-8E0D-415C750283BE},{1214FA70-2308-4C8A-92B2-D658BA181770},{3EAE8150-DECE-4D3E-A650-2FDEB6AC06A5},{508C3727-3C5E-403D-A69D-FD58A4759FD8},{ABFAAF4C-37B3-45C0-A48F-41560AC61B16},{8842998B-BEE6-4442-9AC7-827BB108C9CE},{1861F90F-7187-469B-BC93-3F947F09E089},{5A0271E2-384E-4386-B14A-09C900D39C9B},{3D7432D9-F9E6-4A94-AF65-079743221EC5},{502C11EE-AC93-47C1-8819-36345B2F1911},{3B037825-A72D-4B41-BA9F-BC8EDC9254FA},{9EF6B750-497B-4586-A7DF-BDE2CBADB900},{3873EBC6-BD2F-4564-A4FE-CD52643B5379},{D97A761B-27EA-4665-94F2-4EFCA4427728},{B1E177D9-E3C9-48E0-9518-EB21FF60297C},{6ACA47BD-D211-45CC-9FF4-70996A7D36E6},{15D99A8D-399F-4647-B2A6-29BE98FCBABA},{F33CCB78-FC9C-482C-8F1F-AF6F8D175337},{F2CED60E-2E22-4880-8D21-3AAE1B0DE6CD},{79CA5983-8BAC-4F17-A8E8-1734B40BC979},{2F055533-E701-4240-80FE-77EB4A8BDB40},{3C084453-2142-4090-825F-6933FAD183E3},{507CC839-9CAB-4E89-BEA9-2FDD0C656927},{6070D4F8-D063-49D2-AFB1-55306A31D1B2},{0003EB0E-E867-4A53-95DC-09D0C927E417},{DE58EA68-36EA-4D96-AF41-8394A7F26D23},{507CC839-9CAB-4E89-BEA9-2FDD0C656927},{C40BC86E-8631-4848-8664-EF59EF5C9511},{116E6ADA-13A6-4725-B974-E809513EE233},{3A4BF362-96AB-48DE-B770-B5BC584EDE49},{23013471-C07F-429F-A924-1665D8809D9B},{C5E637C6-5AB6-426F-B638-7DC533AE5C75},{116E6ADA-13A6-4725-B974-E809513EE233},{1C2275A8-369E-4351-9468-8046A273B71F},{919EDB7E-78E9-440D-A8D8-49B2FB254D69},{6D6EE834-0773-404A-9C8E-F5C5F4B73406}) DO (MsiExec.exe /X %%g /qn /norestart >>%log%)
reg delete "HKLM\SOFTWARE\Microsoft\Office\Outlook\Addins\Salesforce for Outlook Side Panel" /f >>%log%
reg delete "HKLM\SOFTWARE\Microsoft\Office\Outlook\Addins\SalesforceForOutlook" /f >>%log%
reg delete "HKCU\Software\Microsoft\Office\Outlook\Addins\Salesforce for Outlook Side Panel" /f >>%log%
reg delete "HKCU\Software\Microsoft\Office\Outlook\Addins\AddinSidePanel.AddinModule" /f >>%log%
reg delete "HKCU\Software\Microsoft\Office\Outlook\Addins\ADXForm" /f >>%log%
:: ------------------
:: Remove problematic add-ins
:: Grammarly
start "" /b /wait "MsiExec.exe" /X{919EDB7E-78E9-440D-A8D8-49B2FB254D69} /passive /norestart
:: MeetingBridge
:: if exist "C:\Program Files (x86)\InstallShield Installation Information\{788468B4-686C-44D9-87B7-E641673375F7}\setup.exe" (
:: start "C:\Program Files (x86)\InstallShield Installation Information\{788468B4-686C-44D9-87B7-E641673375F7}\setup.exe" -runfromtemp -l0x0009 -removeonly
::)
:: Office Live Meeting 2007
start "" /b /wait "MsiExec.exe" /X{389F8A7A-8611-42E8-8169-20D2BAF0C595} /qn /norestart
:: ------------------
:: Log
echo !date! !time!- Clearing Outlook addin registry >>%log%
:: Clear Outlook add-in data
reg delete "HKCU\Software\Microsoft\Office\Outlook\Addins\iTunesAddIn.CalendarHelper" /f >>%log%
reg delete "HKCU\Software\Microsoft\Office\12.0\Outlook\Resiliency\DisabledItems" /f >>%log%
:: ------------------
:: Log
echo !date! !time!- Setting registry permissions >>%log%
:: Set permissions
start "" /wait "C:\Windows\System32\regini.exe" "%LocalDir%\regini.txt"
echo C:\Windows\System32\regini.exe "%LocalDir%\regini.txt" >>%log%
start "" /wait "C:\Windows\SysWOW64\regini.exe" "%LocalDir%\regini.txt"
echo C:\Windows\SysWOW64\regini.exe "%LocalDir%\regini.txt" >>%log%
:: ------------------
:: Log
echo !date! !time!- Setting CSC to clear >>%log%
:: Clear cached network share files in CSC
REG ADD "HKLM\System\CurrentControlSet\Services\CSC\Parameters" /v FormatDatabase /t REG_DWORD /d 1 /f >>%log%
:: ------------------
:: Associate .VBS to correct handler
assoc .vbs=VBSFile
cscript.exe //H:WScript
REG ADD "HKCR\.vbs" /ve /d VBSfile /f
:: ------------------
:: Log
echo !date! !time!- Syncing time >>%log%
:: Sync time regardless of network location
sc config w32time start= auto
net stop w32time
w32tm /config /syncfromflags:manual /manualpeerlist:"time.google.com"
net start w32time
w32tm /resync /nowait
:: ------------------
:: Log
echo !date! !time!- Repairing WMI if required >>%log%
:: Test and repair WMI
WMIC timezone >NUL
if not !ERRORLEVEL!==0 (
echo !date! !time!- Repairing WMI >>%log%
call util\repair_wmi.bat
echo !date! !time!- Repairing WMI - Complete >>%log%
)
@echo on
:: ------------------
if "%wipe-2007%"=="1" (
:: Detect if Office 2007 is installed
if exist "C:\Program Files (x86)\Microsoft Office\Office12\" (
:: Wipe Office 2007
echo !date! !time!- Wiping Office2007 >>%log%
start "" /b /wait "cscript.exe" "%LocalDir%\OffScrub07.vbs" %EDITIONS% /K
echo !date! !time!- Wiping Office2007 - Complete !ERRORLEVEL! >>%log%
)
)
if "%wipe-2010%"=="1" (
:: Detect if Office 2010 is installed
if exist "C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.exe" (
:: Wipe Office 2010
echo !date! !time!- Wiping Office2010 >>%log%
start "" /b /wait "cscript.exe" "%LocalDir%\OffScrub10.vbs" %EDITIONS% /K
echo !date! !time!- Wiping Office2010 - Complete !ERRORLEVEL! >>%log%
)
)
if "%wipe-2013%"=="1" (
:: Wipe Office 2013
echo !date! !time!- Wiping Office2013 >>%log%
start "" /b /wait "cscript.exe" "%LocalDir%\OffScrub_O15msi.vbs" %EDITIONS% /K