├── README.md ├── LICENSE └── OfficeDeploy.bat /README.md: -------------------------------------------------------------------------------- 1 | # OfficeDeployFramework 2 | A batch script to demonstrate complex Microsoft Office deployments 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 SwiftOnSecurity 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /OfficeDeploy.bat: -------------------------------------------------------------------------------- 1 | REM start file - buffer line 2 | :: OfficeDeployFramework 3 | :: Original work by @SwiftOnSecurity https://github.com/SwiftOnSecurity/OfficeDeployFramework 4 | 5 | :: Advanced multi-product, multi-generation Microsoft Office installation orchestration with in-depth options and performance optimization for any scenario 6 | :: Supports MSI editions of Office 2007 through Office 2016. Supports removing existing Click-To-Run products 7 | :: Supports retreiving files interally via UNC and publicly via encrypted packages hosted on HTTPS 8 | :: Works both interactively and via command line arguments for deployment via SCCM 9 | :: 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. 10 | 11 | SETLOCAL ENABLEDELAYEDEXPANSION 12 | @echo on 13 | set "EchoMode=echo" 14 | set "debug=" 15 | 16 | title Microsoft Office installer %1 %3 17 | 18 | set Version=65 19 | set ScriptDate=2018-03-26 20 | 21 | :: [Downloads/caches/loads directly] installation files for Office suites, then installs them 22 | :: Operates over HTTPS or UNC 23 | :: Also performs cleanup and maintenance tasks to increase system performance 24 | 25 | :: Sanity check to prevent clearing root of drive 26 | if not defined Temp exit 27 | if not defined LocalAppData exit 28 | 29 | if /I "%TEMP%"=="" exit 30 | if /I "%TEMP%"=="\" exit 31 | if /I "%TEMP%"=="C:" exit 32 | if /I "%TEMP%"=="C:\" exit 33 | if /I "%TEMP%"=="C:\Windows" exit 34 | if /I "%TEMP%"=="D:\" exit 35 | if /I "%TEMP%"=="E:\" exit 36 | if /I "%TEMP%"=="F:\" exit 37 | 38 | :: Set variables 39 | Set "local=%~dp0" 40 | Set "LocalDir=C:\install\OfficeDeploy" 41 | md "%LocalDir%" 42 | Set "Log=%LocalDir%\log.txt" 43 | Set "LogClean=%LocalDir%\logclean.txt" 44 | 45 | echo !date! !time!- LOG START >>%log% 46 | 47 | :: POSITION 1 - Installation source type (UNC or HTTPS or Liveload) 48 | set "Protocol=%1" 49 | echo Flag - Protocol: %Protocol% >>%log% 50 | :: POSITION 2 - Installation source server (UNC only) 51 | set "SourceServer=%2" 52 | echo Flag - SourceServer: %SourceServer% >>%log% 53 | :: POSITION 3 - Deliverable suite (#) 54 | set "InstallType=%3" 55 | echo Flag - InstallType: %InstallType% >>%log% 56 | :: POSITION 4 - Password to decrypt packages (none to purposely skip, or leave blank for default) 57 | if not "%4"=="" ( 58 | if not "%4"=="none" ( 59 | set "PackagePassword=%4" 60 | echo Flag - Password: Included >>%log% 61 | ) 62 | ) 63 | if not defined PackagePassword ( 64 | set "PackagePassword=%USERDOMAIN%" 65 | echo Flag - Password: Set natively >>%log% 66 | ) 67 | :: POSITION 5 - Enable jumping to local script file after choices and caching (jump to engage, or none) 68 | set "LocalJump=%5" 69 | echo Flag - Jump: %LocalJump% >>%log% 70 | 71 | if "%LocalJump%"=="jump" ( 72 | echo ALERT - JUMPING >>%log% 73 | goto Jump 74 | ) 75 | :: POSITION 6 - Restrict if Office is already installed (restrict or none) 76 | set "Restrict=%6" 77 | echo Flag - Restrict: %Restrict% >>%log% 78 | :: POSITION 7 - Note if script pushed onto machine, reboot at end (reboot or none) 79 | if "%7"=="reboot" ( 80 | set "reboot=reboot" 81 | echo Flag - Reboot: %reboot% >>%log% 82 | ) 83 | 84 | :: Set 32-bit kludge to change 32-bit installs to use 32-bit binaries in some cases 85 | if not defined ProgramFiles(x86) set "32=32" 86 | 87 | :: ------------------ 88 | 89 | :Select-Protocol 90 | :: Choose which transfer and caching method to use for files 91 | 92 | :: Show user interface if not passed through command line 93 | if not defined Protocol ( 94 | echo =====Protocol===== 95 | echo 1 = HTTPS 96 | echo 2 = UNC 97 | echo 3 = Liveload 98 | echo. 99 | set /p ProtocolNumber=Enter your selection: 100 | 101 | :: Take user entry and translate to protocol string 102 | if "!ProtocolNumber!"=="1" set Protocol=HTTPS 103 | if "!ProtocolNumber!"=="2" set Protocol=UNC 104 | if "!ProtocolNumber!"=="3" set Protocol=Liveload 105 | 106 | ) 107 | 108 | :: Redo title 109 | title Microsoft Office installer %Protocol% %3 110 | 111 | :: Return to start of section if user entry invalid 112 | if not defined Protocol goto Select-Protocol 113 | 114 | :: Log 115 | echo Protocol: %Protocol% >>%log% 116 | 117 | :Select-Protocol-End 118 | 119 | :: ------------------ 120 | 121 | :Select-SourceServer 122 | :: Choose which internal server to use, if applicable 123 | 124 | :: Skip if protocol is HTTPS 125 | REM if "%Protocol%"=="HTTPS" goto Select-SourceServer-End 126 | 127 | :: Show user interface if not passed through command line 128 | if not defined SourceServer ( 129 | echo =====SourceServer===== 130 | echo 1 = SERVER0 131 | echo 2 = SERVER1 132 | echo 3 = SERVER2 133 | echo 4 = SERVER3 134 | echo. 135 | set /p SourceServerNumber=Enter your selection: 136 | 137 | :: Take user entry and translate to protocol string 138 | if "!SourceServerNumber!"=="1" set "SourceServer=\\server0\MicrosoftOffice\OfficeDeploy" 139 | if "!SourceServerNumber!"=="2" set "SourceServer=\\server1\MicrosoftOffice\OfficeDeploy" 140 | if "!SourceServerNumber!"=="3" set "SourceServer=\\server2\MicrosoftOffice\OfficeDeploy" 141 | if "!SourceServerNumber!"=="4" set "SourceServer=\\server3\MicrosoftOffice\OfficeDeploy" 142 | 143 | ) 144 | 145 | :: Return to start of section if user entry invalid 146 | if not defined SourceServer goto Select-SourceServer-End 147 | 148 | :: Log 149 | echo SourceServer: %SourceServer% >>%log% 150 | 151 | %debug% 152 | :Select-SourceServer-End 153 | 154 | :: ------------------ 155 | 156 | :Select-InstallType 157 | :: Choose which software to install 158 | 159 | :: Show user interface if not passed through command line 160 | if not defined InstallType ( 161 | echo =====InstallType===== 162 | echo 1 = Office 2016 Standard x86 163 | echo 2 = Outlook 2016 x86 164 | echo 3 = Office 2007 + Outlook 2016 x86 + Full purge 165 | echo 4 = Office 2013 Pro Plus x86 166 | echo 5 = Office 2007 + Outlook 2016 + Access 2016 + Full purge 167 | echo 6 = Hollow install 168 | echo 7 = Office 2007 + Outlook 2016 + Access 2016 + Full purge 169 | echo 8 = Retrofit Access 2016 170 | echo 9 = Office 2016 + Access 2016 + Full purge 171 | echo. 172 | set /p InstallType=Enter your selection: 173 | ) 174 | 175 | :: Log 176 | echo InstallType: %InstallType% >>%log% 177 | 178 | :: ------------------ 179 | 180 | :Select-Restriction 181 | :: Skip install if Restrict parameter is passed and Office already installed 182 | 183 | if "%Restrict%"=="restrict" ( 184 | :: Check Office 2010 185 | if exist "C:\Program Files (x86)\Microsoft Office\Office14\Outlook.exe" ( 186 | :: Catch if script resumed from wrong position 187 | if not "%Restrict%"=="restrict" goto Select-Protocol 188 | echo Restricted - Office2010 detected >>%log% 189 | goto Error-Restricted 190 | ) 191 | :: Check Office 2013 192 | if exist "C:\Program Files (x86)\Microsoft Office\Office15\Outlook.exe" ( 193 | :: Catch if script resumed from wrong position 194 | if not "%Restrict%"=="restrict" goto Select-Protocol 195 | echo Restricted - Office2013 detected >>%log% 196 | goto Error-Restricted 197 | ) 198 | :: Check Office 2016 199 | if exist "C:\Program Files (x86)\Microsoft Office\Office16\Outlook.exe" ( 200 | :: Catch if script resumed from wrong position 201 | if not "%Restrict%"=="restrict" goto Select-Protocol 202 | echo Restricted - Office2016 detected >>%log% 203 | goto Error-Restricted 204 | ) 205 | ) 206 | 207 | :: ------------------ 208 | 209 | :UpdateLogic 210 | :: Retrieve core bootstrap files from UNC server if specified and cache locally 211 | robocopy "%SourceServer%" "%LocalDir%" /R:0 /FFT /LEV:1 /XF *.exe && goto UpdateLogic-End 212 | :UpdateLogic-End 213 | 214 | :UpdateUtil 215 | robocopy "%SourceServer%\util" "%LocalDir%\util" /R:0 /FFT /LEV:1 216 | :UpdateUtil-End 217 | 218 | 219 | %debug% 220 | :: ------------------ 221 | 222 | :: Jumping to local script instead of continuing in network script 223 | echo !date! !time! JUMPING - %LocalDir%\installoffice2016.bat %Protocol% %SourceServer% %InstallType% -x- jump >>%log% 224 | 225 | %LocalDir%\installoffice2016.bat %Protocol% %SourceServer% %InstallType% %PackagePassword% jump 226 | exit 227 | 228 | :Jump 229 | 230 | echo !date! !time!- JUMP SUCCESSFUL >>%log% 231 | title Microsoft Office installer %1 %3 232 | :: ------------------ 233 | 234 | :: Office 2016 Standard - subflags 235 | if "%InstallType%"=="1" ( 236 | echo !date! !time!- Office 2016 variables loading >>%log% 237 | set "Exclude=UpdateOffice2007.7z Office2007ProPlus.7z Office2013ProPlusx86.7z UpdateOffice2013.7z Outlook2016x86.7z NvidiaMobileDriver.7z" 238 | 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%" 239 | set "wipe-2007=1" 240 | set "wipe-2010=0" 241 | set "wipe-2013=0" 242 | set "wipe-2016=1" 243 | set "wipe-c2r=1" 244 | set "clear-2007exe=1" 245 | set "clear-ost=1" 246 | set "install-Office2007=0" 247 | set "install-Access2007=0" 248 | set "skip-patch2007=0" 249 | set "install-Office2013PP=0" 250 | set "install-Office2016Std=1" 251 | set "install-Outlook2016=0" 252 | set "install-Access2016=0" 253 | set "install-Access2016Runtime=1" 254 | set "install-SkypeForBusiness2016Basic=1" 255 | set "install-Visio2016Viewer=1" 256 | ) 257 | 258 | :: Outlook 2016 - subflags 259 | if "%InstallType%"=="2" ( 260 | echo !date! !time!- Outlook 2016 variables loading >>%log% 261 | set "Exclude=Access2016Runtime.7z UpdateOffice2007.7z Office2007ProPlus.7z Office2013ProPlusx86.7z UpdateOffice2013.7z Office2016Standardx86.7z NvidiaMobileDriver.7z" 262 | 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%" 263 | set "wipe-2007=0" 264 | set "wipe-2010=0" 265 | set "wipe-2013=0" 266 | set "wipe-2016=1" 267 | set "wipe-c2r=1" 268 | set "clear-2007exe=0" 269 | set "clear-ost=1" 270 | set "install-Office2007=0" 271 | set "install-Access2007=0" 272 | set "skip-patch2007=0" 273 | set "install-Office2013PP=0" 274 | set "install-Office2016Std=0" 275 | set "install-Outlook2016=1" 276 | set "install-Access2016=0" 277 | set "install-Access2016Runtime=1" 278 | set "install-SkypeForBusiness2016Basic=1" 279 | set "install-Visio2016Viewer=1" 280 | ) 281 | 282 | :: Office 2007 + Outlook 2016 x86 + Full purge - subflags 283 | if "%InstallType%"=="3" ( 284 | echo !date! !time!- Office 2007 + Outlook 2016 x86 + Full purge variables loading >>%log% 285 | set "Exclude=Access2016Runtime.7z Office2013ProPlusx86.7z UpdateOffice2013.7z Office2016Standardx86.7z NvidiaMobileDriver.7z" 286 | set "EDITIONS=ALL /Quiet /Log %LOCALDIR%" 287 | set "wipe-2007=1" 288 | set "wipe-2010=1" 289 | set "wipe-2013=1" 290 | set "wipe-2016=1" 291 | set "wipe-c2r=1" 292 | set "clear-2007exe=0" 293 | set "clear-ost=1" 294 | set "install-Office2007=1" 295 | set "install-Access2007=0" 296 | set "skip-patch2007=0" 297 | set "install-Office2013PP=0" 298 | set "install-Office2016Std=0" 299 | set "install-Outlook2016=1" 300 | set "install-Access2016=0" 301 | set "install-Access2016Runtime=1" 302 | set "install-SkypeForBusiness2016Basic=1" 303 | set "install-Visio2016Viewer=1" 304 | ) 305 | 306 | :: Office 2013 - subflags 307 | if "%InstallType%"=="4" ( 308 | echo !date! !time!- Office 2013 variables loading >>%log% 309 | set "Exclude=Access2016Runtime.7z UpdateOffice2007.7z Office2007ProPlus.7z Office2016Standardx86.7z Outlook2016x86.7z UpdateOffice2016.7z NvidiaMobileDriver.7z" 310 | 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%" 311 | set "wipe-2007=1" 312 | set "wipe-2010=0" 313 | set "wipe-2013=0" 314 | set "wipe-2016=1" 315 | set "wipe-c2r=1" 316 | set "clear-2007exe=1" 317 | set "clear-ost=1" 318 | set "install-Office2007=0" 319 | set "install-Access2007=0" 320 | set "skip-patch2007=0" 321 | set "install-Office2013PP=1" 322 | set "install-Office2016Std=0" 323 | set "install-Outlook2016=0" 324 | set "install-Access2016=0" 325 | set "install-Access2016Runtime=0" 326 | set "install-SkypeForBusiness2016Basic=1" 327 | set "install-Visio2016Viewer=1" 328 | ) 329 | 330 | :: Office 2007 + Outlook 2016 + Access 2016 + Full purge 331 | if "%InstallType%"=="5" ( 332 | echo !date! !time!- Office 2007 + Outlook 2016 + Access 2016 variables loading >>%log% 333 | set "Exclude=Access2016Runtime.7z Office2013ProPlusx86.7z UpdateOffice2013.7z Office2016Standardx86.7z Outlook2016x86.7z NvidiaMobileDriver.7z" 334 | set "EDITIONS=STANDARD,BASIC,PRO,AccessRuntime,Proof,HomeAndStudent,Enterprise,ProfessionalHybrid,Personal,Ultimate,CLICK2RUN,SmallBusiness,Groove,Outlook,CLIENTSUITES,PIA /Quiet /Log %LOCALDIR%" 335 | set "wipe-2007=1" 336 | set "wipe-2010=1" 337 | set "wipe-2013=1" 338 | set "wipe-2016=1" 339 | set "wipe-c2r=1" 340 | set "clear-2007exe=0" 341 | set "clear-ost=0" 342 | set "install-Office2007=1" 343 | set "install-Access2007=0" 344 | set "skip-patch2007=0" 345 | set "install-Office2013PP=0" 346 | set "install-Office2016Std=0" 347 | set "install-Outlook2016=1" 348 | set "install-Access2016=1" 349 | set "install-Access2016Runtime=0" 350 | set "install-SkypeForBusiness2016Basic=1" 351 | set "install-Visio2016Viewer=1" 352 | ) 353 | 354 | :: Hollow install - subflags 355 | if "%InstallType%"=="6" ( 356 | echo !date! !time!- Hollow install variables loading >>%log% 357 | set "Exclude=Access2016Runtime.7z NvidiaMobileDriver.7z Office2007ProPlus.7z Office2013ProPlusx86.7z UpdateOffice2013.7z Office2016Standardx86.7z Outlook2016x86.7z UpdateOffice2007.7z UpdateOffice2013.7z UpdateOffice2016.7z " 358 | set "EDITIONS=/Quiet /Log %LOCALDIR%" 359 | set "wipe-2007=0" 360 | set "wipe-2010=0" 361 | set "wipe-2013=0" 362 | set "wipe-2016=0" 363 | set "wipe-c2r=1" 364 | set "clear-2007exe=0" 365 | set "clear-ost=0" 366 | set "install-Office2007=0" 367 | set "install-Access2007=0" 368 | set "skip-patch2007=0" 369 | set "install-Office2013PP=0" 370 | set "install-Office2016Std=0" 371 | set "install-Outlook2016=0" 372 | set "install-Access2016=0" 373 | set "install-Access2016Runtime=0" 374 | set "install-SkypeForBusiness2016Basic=1" 375 | set "install-Visio2016Viewer=1" 376 | ) 377 | 378 | :: Office 2007 + Outlook 2016 + Access 2016 + Full purge - subflags 379 | if "%InstallType%"=="7" ( 380 | echo !date! !time!- Office 2007 + Outlook 2016 + Access 2016 + Full purge >>%log% 381 | set "Exclude=A2016.7z O2013PPSP1x86.7z UO2013.7z O2016Sx86.7z NVMOBILE.7z" 382 | set "EDITIONS=ALL /Quiet /Log %LOCALDIR%" 383 | set "wipe-2007=1" 384 | set "wipe-2010=1" 385 | set "wipe-2013=1" 386 | set "wipe-2016=1" 387 | set "wipe-c2r=1" 388 | set "clear-2007exe=1" 389 | set "clear-ost=0" 390 | set "install-Office2007=1" 391 | set "install-Access2007=0" 392 | set "skip-patch2007=0" 393 | set "install-Office2013PP=0" 394 | set "install-Office2016Std=0" 395 | set "install-Outlook2016=1" 396 | set "install-Access2016=1" 397 | set "skip-patch2016=0" 398 | set "install-Access2016Runtime=0" 399 | set "install-SkypeForBusiness2016Basic=1" 400 | set "install-Visio2016Viewer=1" 401 | ) 402 | 403 | :: Retrofit Access 2016 404 | if "%InstallType%"=="8" ( 405 | echo !date! !time!- Retrofit Access 2016 x86 variables loading >>%log% 406 | set "Exclude=Access2016Runtime.7z Office2013ProPlusx86.7z UpdateOffice2013.7z Office2016Standardx86.7z NvidiaMobileDriver.7z" 407 | set "EDITIONS=ACCESS,ACCESSRT,AccessRuntime /Quiet /Log %LOCALDIR%" 408 | set "wipe-2007=0" 409 | set "wipe-2010=0" 410 | set "wipe-2013=0" 411 | set "wipe-2016=0" 412 | set "wipe-c2r=1" 413 | set "clear-2007exe=0" 414 | set "clear-ost=0" 415 | set "install-Office2007=0" 416 | set "install-Access2007=0" 417 | set "skip-patch2007=1" 418 | set "install-Office2013PP=0" 419 | set "install-Office2016Std=0" 420 | set "install-Outlook2016=0" 421 | set "install-Access2016=1" 422 | set "skip-patch2016=1" 423 | set "skip-aux=1" 424 | set "install-Access2016Runtime=0" 425 | set "install-SkypeForBusiness2016Basic=0" 426 | set "install-Visio2016Viewer=0" 427 | del "%LocalDir%\Packages\*.*" /f /s /q >>%logclean% 428 | ) 429 | 430 | :: Office 2016 + Access 2016 + Full purge 431 | if "%InstallType%"=="9" ( 432 | echo !date! !time!- Office 2016 + Access 2016 + Full Purge variables loading >>%log% 433 | set "Exclude=Access2016Runtime.7z Office2013ProPlusx86.7z UpdateOffice2013.7z Office2016Standardx86.7z NvidiaMobileDriver.7z" 434 | set "EDITIONS=ALL /Quiet /Log %LOCALDIR%" 435 | set "wipe-2007=1" 436 | set "wipe-2010=1" 437 | set "wipe-2013=1" 438 | set "wipe-2016=1" 439 | set "wipe-c2r=1" 440 | set "clear-2007exe=1" 441 | set "clear-ost=0" 442 | set "install-Office2007=0" 443 | set "install-Access2007=0" 444 | set "skip-patch2007=1" 445 | set "install-Office2013PP=0" 446 | set "install-Office2016Std=1" 447 | set "install-Outlook2016=0" 448 | set "install-Access2016=1" 449 | set "skip-aux=0" 450 | set "install-Access2016Runtime=0" 451 | set "install-SkypeForBusiness2016Basic=1" 452 | set "install-Visio2016Viewer=1" 453 | ) 454 | 455 | :: ------------------ 456 | 457 | :: Activate Windows if not already completed 458 | start "" "cscript.exe" "c:\windows\system32\slmgr.vbs" /ato 459 | 460 | :: Log 461 | echo !date! !time!- Activate Windows triggered >>%log% 462 | 463 | :: ------------------ 464 | 465 | :: Prevent sleep or screensaver until reboot 466 | taskkill /im "caffeine.exe" /f 467 | start "" /b "%LocalDir%\util\caffeine.exe" -noicon 468 | 469 | :: ------------------ 470 | 471 | :: Log computer information 472 | WMIC path Win32_ComputerSystem >> "%LocalDir%\model.txt" 473 | start /b WMIC path Win32_BIOS Get Name >> "%LocalDir%\bios.txt" 474 | start /b WMIC path Win32_PnPEntity Get Name >> "%LocalDir%\hardware.txt" 475 | start /b WMIC path Win32_Product Get Name >> "%LocalDir%\software.txt" 476 | start /b wmic bios get serialnumber >> "%LocalDir%\model.txt" 477 | 478 | type "%LocalDir%\model.txt" | FIND "Dell" 479 | if !ERRORLEVEL! == 0 set HWOEM=Dell 480 | 481 | type "%LocalDir%\model.txt" | FIND "E6430" 482 | if !ERRORLEVEL! == 0 set HWMODEL=E6430 483 | if !ERRORLEVEL! == 0 set VIDEO=NVMOBILE 484 | 485 | type "%LocalDir%\model.txt" | FIND "E6420" 486 | if !ERRORLEVEL! == 0 set HWMODEL=E6420 487 | if !ERRORLEVEL! == 0 set VIDEO=NVMOBILE 488 | 489 | :: ------------------ 490 | 491 | :CLEAN-BEGIN 492 | 493 | :: Close Office 494 | 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%) 495 | 496 | :: Re-register MSIEXEC, in case it's corrupt 497 | start "" /b /wait "msiexec.exe" /regserver 498 | 499 | if "%skip-aux%"=="1" goto CLEAN-END 500 | 501 | :: ------------------ 502 | 503 | :: ------------------ 504 | :: ----CLEANING----- 505 | 506 | :: Log 507 | echo !date! !time!- Begin cleaning, see %logclean% >>%log% 508 | 509 | :: Clear unused profiles to free disk space and MFT 510 | start "" /b /wait "%LocalDir%\util\delprof2.exe" /d:45 /u >>%logclean% 511 | 512 | :: ------------------ 513 | 514 | :: Clear OST 515 | if "%clear-ost%"=="1" ( 516 | del /q /f /s "C:\Users\*.ost" >>%logclean% 517 | for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Local\Microsoft\Outlook\*.ost" >>%logclean% 518 | ) 519 | 520 | for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Outlook" >>%logclean% 521 | 522 | :: ------------------ 523 | 524 | :: Clear temp files in user profile and Windows directory 525 | del /q /f "C:\Windows\*.log" >>%logclean% 526 | del "%TEMP%\*.*" /f /s /q >>%logclean% 527 | rd /S /Q "%TEMP%\" >>%logclean% 528 | md "%TEMP%" >>%logclean% 529 | del "C:\Windows\Temp\*.*" /f /s /q >>%logclean% 530 | rd /S /Q "C:\Windows\Temp\" >>%logclean% 531 | del "C:\$RECYCLE.BIN\*.*" /f /s /q >>%logclean% 532 | rd /S /Q "C:\$RECYCLE.BIN\" >>%logclean% 533 | 534 | :: ------------------ 535 | 536 | :: Remove all user temp files 537 | for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Temp\*.*" >>%logclean% 538 | for /d %%a in (C:\Users\*) do rd /S /Q "%%a\AppData\Local\Temp\*.*" >>%logclean% 539 | 540 | :: ------------------ 541 | 542 | :: Clear Office caches 543 | for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Roaming\Microsoft\Templates\Normal*" >>%logclean% 544 | 545 | for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Office\16.0\*.*" >>%logclean% 546 | for /d %%a in (C:\Users\*) do RD /s /q "%%a\AppData\Local\Microsoft\Office\16.0" >>%logclean% 547 | 548 | for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\microsoft\forms\*.*" >>%logclean% 549 | for /d %%a in (C:\Users\*) do RD /s /q "%%a\AppData\Local\microsoft\forms" >>%logclean% 550 | for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Outlook\16\*.*" >>%logclean% 551 | for /d %%a in (C:\Users\*) do RD /s /q "%%a\AppData\Local\Microsoft\Outlook\16" >>%logclean% 552 | for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Outlook\gliding\*.*" >>%logclean% 553 | for /d %%a in (C:\Users\*) do RD /s /q "%%a\AppData\Local\Microsoft\Outlook\gliding" >>%logclean% 554 | for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Outlook\Offline Address Books\*.*" >>%logclean% 555 | for /d %%a in (C:\Users\*) do RD /s /q "%%a\AppData\Local\Microsoft\Outlook\Offline Address Books" >>%logclean% 556 | for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Outlook\RoamCache\*.*" >>%logclean% 557 | for /d %%a in (C:\Users\*) do RD /s /q "%%a\AppData\Local\Microsoft\Outlook\RoamCache" >>%logclean% 558 | 559 | for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Local\Microsoft\Outlook\*.dat" >>%logclean% 560 | for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Local\Microsoft\Outlook\*.oab" >>%logclean% 561 | for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Local\Microsoft\Outlook\*.obi" >>%logclean% 562 | for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Local\Microsoft\Outlook\*.xml" >>%logclean% 563 | for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Local\Microsoft\Office\16.0\*.*" >>%logclean% 564 | 565 | for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Roaming\Microsoft\Outlook\*.dat" >>%logclean% 566 | for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Roaming\Microsoft\Outlook\*.srs" >>%logclean% 567 | for /d %%a in (C:\Users\*) do del /q /f "%%a\AppData\Roaming\Microsoft\Outlook\*.xml" >>%logclean% 568 | 569 | :: ------------------ 570 | 571 | :: Clear Temporary Internet Files 572 | for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\*.*" >>%logclean% 573 | for /d %%a in (C:\Users\*) do RD /s /q "%%a\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\" >>%logclean% 574 | 575 | for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.MSO\*.*" >>%logclean% 576 | 577 | for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\*.*" >>%logclean% 578 | 579 | for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Word\*.*" >>%logclean% 580 | 581 | for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Windows\Tempor~1\*.*" >>%logclean% 582 | for /d %%a in (C:\Users\*) do RD /s /q "%%a\AppData\Local\Microsoft\Windows\Tempor~1" >>%logclean% 583 | 584 | for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Internet Explorer\Recovery\*.*" >>%logclean% 585 | 586 | for /d %%a in (C:\Users\*) do del /f /s /q "%%a\AppData\Local\Microsoft\Windows\INetCache\IE\*.*" >>%logclean% 587 | 588 | start "" /b /wait RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8 589 | 590 | :: ---------------------- 591 | 592 | :: Clear Windows 10 upgrade files 593 | del /q /f "C:\$WINDOWS.~BT\*.*" >>%logclean% 594 | rd /S /Q "C:\$WINDOWS.~BT\" >>%logclean% 595 | 596 | :: ------------------ 597 | 598 | :: Clear unneeded files in root of drive 599 | attrib -h -s "C:\WinPEpge.sys" >>%logclean% 600 | del "C:\WinPEpge.sys" /f >>%logclean% 601 | del /f /s /q "C:\$Recycle.Bin\" >>%logclean% 602 | rd /s /q "C:\$Recycle.Bin\" >>%logclean% 603 | del /f /s /q "C:\hotfix\*.*" >>%logclean% 604 | rd /s /q "C:\hotfix\" >>%logclean% 605 | del /f /s /q "C:\intel\*.*" >>%logclean% 606 | rd /s /q "C:\intel\" >>%logclean% 607 | del /f /s /q "C:\logs\*.*" >>%logclean% 608 | rd /s /q "C:\logs\" >>%logclean% 609 | 610 | :: ------------------ 611 | 612 | :: Clear old Volume Shadow Copies 613 | start "" /b /wait "net.exe" start VSS >>%logclean% 614 | start "" /b /wait "vssadmin.exe" delete shadows /for=%SystemDrive% /oldest /quiet >>%logclean% 615 | 616 | :: ------------------ 617 | 618 | :: Clean Windows 619 | del "C:\Windows\Logs\CBS\*.*" /f /s /q >>%logclean% 620 | reg import "%LocalDir%\cleanmgr.reg" 621 | ::start "" /b /wait "cleanmgr.exe" /sagerun:1337 /verylowdisk 622 | 623 | :CLEAN-END 624 | 625 | :: ------------------ 626 | :: ----DOWNLOADS----- 627 | 628 | :: Log 629 | echo !date! !time!- Jumping to Protocol %protocol% >>%log% 630 | 631 | :: Jump to protocol we'll be using 632 | goto %Protocol% 633 | 634 | :: ------------------ 635 | 636 | :HTTPS 637 | 638 | ::Set InstallDir to the same as LocalDir 639 | set "InstallDir=%LocalDir%" 640 | 641 | :: Log 642 | echo !date! !time!- HTTPS download started >>%log% 643 | 644 | ::Setup wget 645 | ::Preload KeyCDN certificate in system store with BITSADMIN download 646 | :: Set random number 647 | set "Rand=%RANDOM%" 648 | start "" /wait "bitsadmin.exe" /transfer KeyCDN%rand% /PRIORITY FOREGROUND /download "https://filestore.kxcdn.com/" "%TEMP%\tempfile%rand%" 649 | 650 | :: --UNIVERSAL-- 651 | echo !date! !time!- HTTPS Universal download starting >>%log% 652 | 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 653 | 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 654 | 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 655 | 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 656 | 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 657 | 658 | :: --HARDWARE-- 659 | ::Intel 660 | 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 661 | 662 | ::Dell 663 | if "%HWOEM%"=="Dell" ( 664 | echo !date! !time!- HTTPS Dell download starting >>%log% 665 | 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 666 | ) 667 | 668 | ::E6430 669 | if "%VIDEO%"=="NVMOBILE" ( 670 | echo !date! !time!- HTTPS nVidia mobile download starting >>%log% 671 | 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 672 | ) 673 | 674 | 675 | :: --Office 2007 Pro Plus x86-- 676 | if "%install-Office2007%"=="1" ( 677 | :: Download Office2007 Pro Plus x86 678 | echo !date! !time!- HTTPS Office 2007 download starting >>%log% 679 | 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 680 | 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 681 | ) 682 | 683 | :: --Office 2013 ProPlus SP1 x86-- 684 | if "%install-Office2013PP%"=="1" ( 685 | :: Download Office2013 ProPlus SP1 x86 686 | echo !date! !time!- HTTPS Office 2013 download starting >>%log% 687 | 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 688 | 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 689 | ) 690 | 691 | :: --Access 2016 x86-- 692 | if "%install-Access2016%"=="1" ( 693 | :: Download Access2016 Runtime 694 | echo !date! !time!- HTTPS Access 2016 x86 download starting >>%log% 695 | 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 696 | ) 697 | 698 | :: --Access 2016 Runtime x86-- 699 | if "%install-Access2016Runtime%"=="1" ( 700 | :: Download Access2016 Runtime 701 | echo !date! !time!- HTTPS Access Runtime x86 download starting >>%log% 702 | 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 703 | 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 704 | ) 705 | 706 | :: --Skype for Business 2016 Basic x86-- 707 | if "%install-SkypeForBusiness2016Basic%"=="1" ( 708 | :: Download Skype for Business 2016 Basic 709 | echo !date! !time!- HTTPS S4B download starting >>%log% 710 | 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 711 | 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 712 | ) 713 | 714 | :: --Office 2016 Std x86-- 715 | if "%install-Office2016Std%"=="1" ( 716 | :: Download Office 2016 Standard 717 | echo !date! !time!- HTTPS Office2016 download starting >>%log% 718 | 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 719 | 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 720 | ) 721 | 722 | :: --Outlook 2016 x86-- 723 | if "%install-Outlook2016%"=="1" ( 724 | :: Download Outlook 2016 725 | echo !date! !time!- HTTPS Outlook2016 download starting >>%log% 726 | 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 727 | 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 728 | ) 729 | 730 | goto Protocol-End 731 | 732 | :: ------------------ 733 | 734 | title Microsoft Office installer %1 %3 735 | 736 | :: ------------------ 737 | 738 | :UNC 739 | 740 | :: Log 741 | echo !date! !time!- Begin UNC copy >>%log% 742 | 743 | ::Set InstallDir to the same as LocalDir 744 | set "InstallDir=%LocalDir%" 745 | 746 | start "" /b /wait "robocopy" "%SourceServer%\packages" "%LocalDir%\packages\\" /MIR /FFT /Z /R:1 /XF %Exclude% 747 | echo !date! !time!- Robocopy errorlevel: !ERRORLEVEL! >>%log% 748 | 749 | if "%VIDEO%"=="NVMOBILE" ( 750 | echo !date! !time!- Copying NVMOBILE >>%log% 751 | start "" /b /wait "xcopy" "%SourceServer%\packages\NvidiaMobileDriver.7z" "%LocalDir%\packages" 752 | ) 753 | 754 | goto Protocol-End 755 | 756 | :: ------------------ 757 | 758 | :Liveload 759 | 760 | :: Log 761 | echo !date! !time!- Liveload - no copy needed >>%log% 762 | 763 | ::Set InstallDir to the server 764 | set "InstallDir=%SourceServer%" 765 | 766 | goto Protocol-End 767 | 768 | :: ------------------ 769 | 770 | :Protocol-End 771 | 772 | :: Log 773 | echo !date! !time!- End of downloads >>%log% 774 | 775 | :: ------------------ 776 | :: ----EXTRACTION----- 777 | 778 | :: Log 779 | echo !date! !time!- Extracting >>%log% 780 | 781 | cd "%LOCALDIR%\Packages" 782 | 783 | for /F "delims=:" %%A IN ('dir /b %LOCALDIR%\Packages\*.7z') DO ( 784 | start "" /b /wait "%LocalDir%\util\7za.exe" -p%PackagePassword% -y x %%A 785 | echo !date! !time!- Extraction errorlevel: !ERRORLEVEL! >>%log% 786 | ) 787 | 788 | cd "%LOCALDIR% 789 | 790 | :: ------------------ 791 | 792 | :: Log 793 | echo !date! !time!- Closing programs >>%log% 794 | 795 | :: Close Office 796 | 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%) 797 | 798 | :: ------------------ 799 | 800 | :CONFIG-BEGIN 801 | if "%skip-aux%"=="1" goto CONFIG-END 802 | 803 | :: ------------------ 804 | 805 | :: Log 806 | echo !date! !time!- Disabling telemetry1 >>%log% 807 | 808 | :: DisableProgramTelemetry1 809 | schtasks /change /TN "\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" /DISABLE 810 | schtasks /change /TN "\Microsoft\Windows\Application Experience\ProgramDataUpdater" /DISABLE 811 | schtasks /change /TN "\Microsoft\Windows\Application Experience\StartupAppTask" /DISABLE 812 | schtasks /change /TN "\Microsoft\Windows\Application Experience\AitAgent" /DISABLE 813 | schtasks /change /TN "\Microsoft\Windows\WindowsBackup\ConfigNotification" /DISABLE 814 | schtasks /change /TN "\Microsoft\Windows\RemoteAssistance\RemoteAssistanceTask" /DISABLE 815 | wevtutil sl AirSpaceChannel /e:false 816 | wevtutil cl AirSpaceChannel 817 | 818 | reg add "HKCU\Software\Policies\Microsoft\Windows\AppCompat" /v DisablePCA /t REG_DWORD /d 1 /f 819 | reg add "HKLM\Software\Policies\Microsoft\Windows\AppCompat" /v DisableUAR /t REG_DWORD /d 1 /f 820 | reg add "HKLM\Software\Policies\Microsoft\Windows\AppCompat" /v AITEnable /t REG_DWORD /d 0 /f 821 | reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience/Program-Telemetry" /v Enabled /t REG_DWORD /d 0 /f 822 | reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience/Program-Compatibility-Assistant" /v Enabled /t REG_DWORD /d 0 /f 823 | reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience/Program-Compatibility-Troubleshooter" /v Enabled /t REG_DWORD /d 0 /f 824 | reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience/Program-Inventory" /v Enabled /t REG_DWORD /d 0 /f 825 | 826 | :: ------------------ 827 | 828 | :: Log 829 | echo !date! !time!- Resetting Windows Search >>%log% 830 | 831 | :: Reset Windows Search 832 | sc config WSearch start= disabled >>%log% 833 | net stop WSearch >>%log% 834 | reg.exe delete "HKLM\Software\Microsoft\Windows Search" /v SetupCompletedSuccessfully /f >>%log% 835 | RD /S /Q "C:\ProgramData\Microsoft\Search" >>%logclean% 836 | 837 | :: ------------------ 838 | 839 | :: Log 840 | echo !date! !time!- Stopping Windows Update >>%log% 841 | 842 | :: Clean Windows Update 843 | sc config wuauserv start= disabled >>%log% 844 | net stop wuauserv >>%log% 845 | if exist "%windir%\softwaredistribution\download" rmdir /s /q "%windir%\softwaredistribution\download" 846 | 847 | :: ------------------ 848 | 849 | :: Log 850 | echo !date! !time!- Stopping C2R >>%log% 851 | 852 | :: Stop Click2Run 853 | sc config ClickToRunSvc start= disabled >>%log% 854 | net stop ClickToRunSvc >>%log% 855 | schtasks /change /TN "\Microsoft\Office\Office Automatic Updates" /DISABLE >>%log% 856 | 857 | 858 | :: ------------------ 859 | 860 | :: Log 861 | echo !date! !time!- Removing C2R and Telemetry >>%log% 862 | 863 | :: Remove Office C2R and Telemetry 864 | 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 865 | 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 866 | 867 | :: Remove Office C2R Extensibility 868 | start "" /b /wait "MsiExec.exe" /X{90160000-008C-0000-0000-0000000FF1CE} /qn /norestart 869 | start "" /b /wait "MsiExec.exe" /X{90160000-008F-0000-1000-0000000FF1CE} /qn /norestart 870 | start "" /b /wait "MsiExec.exe" /X{90160000-008C-0409-0000-0000000FF1CE} /qn /norestart 871 | start "" /b /wait "MsiExec.exe" /X{90160000-00DD-0000-1000-0000000FF1CE} /qn /norestart 872 | 873 | :: Remove Telemetery 874 | start "" /b /wait "MsiExec.exe" /X{90160000-0132-0409-1000-0000000FF1CE} /qn /norestart 875 | 876 | :: Force-remove 877 | WMIC product where "Name like '%%click-to-run%%'" call uninstall /nointeractive 878 | 879 | :: ------------------ 880 | 881 | :: Log 882 | echo !date! !time!- Removing Salesforce >>%log% 883 | 884 | :: Uninstall Salesforce for Outlook 885 | taskkill /im sfdcmsol.exe /f >>%log% 886 | 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%) 887 | reg delete "HKLM\SOFTWARE\Microsoft\Office\Outlook\Addins\Salesforce for Outlook Side Panel" /f >>%log% 888 | reg delete "HKLM\SOFTWARE\Microsoft\Office\Outlook\Addins\SalesforceForOutlook" /f >>%log% 889 | 890 | reg delete "HKCU\Software\Microsoft\Office\Outlook\Addins\Salesforce for Outlook Side Panel" /f >>%log% 891 | reg delete "HKCU\Software\Microsoft\Office\Outlook\Addins\AddinSidePanel.AddinModule" /f >>%log% 892 | reg delete "HKCU\Software\Microsoft\Office\Outlook\Addins\ADXForm" /f >>%log% 893 | 894 | :: ------------------ 895 | 896 | :: Remove problematic add-ins 897 | 898 | :: Grammarly 899 | start "" /b /wait "MsiExec.exe" /X{919EDB7E-78E9-440D-A8D8-49B2FB254D69} /passive /norestart 900 | 901 | :: MeetingBridge 902 | :: if exist "C:\Program Files (x86)\InstallShield Installation Information\{788468B4-686C-44D9-87B7-E641673375F7}\setup.exe" ( 903 | :: start "C:\Program Files (x86)\InstallShield Installation Information\{788468B4-686C-44D9-87B7-E641673375F7}\setup.exe" -runfromtemp -l0x0009 -removeonly 904 | ::) 905 | 906 | :: Office Live Meeting 2007 907 | start "" /b /wait "MsiExec.exe" /X{389F8A7A-8611-42E8-8169-20D2BAF0C595} /qn /norestart 908 | 909 | :: ------------------ 910 | 911 | :: Log 912 | echo !date! !time!- Clearing Outlook addin registry >>%log% 913 | 914 | :: Clear Outlook add-in data 915 | reg delete "HKCU\Software\Microsoft\Office\Outlook\Addins\iTunesAddIn.CalendarHelper" /f >>%log% 916 | reg delete "HKCU\Software\Microsoft\Office\12.0\Outlook\Resiliency\DisabledItems" /f >>%log% 917 | 918 | :: ------------------ 919 | 920 | :: Log 921 | echo !date! !time!- Setting registry permissions >>%log% 922 | 923 | :: Set permissions 924 | start "" /wait "C:\Windows\System32\regini.exe" "%LocalDir%\regini.txt" 925 | echo C:\Windows\System32\regini.exe "%LocalDir%\regini.txt" >>%log% 926 | start "" /wait "C:\Windows\SysWOW64\regini.exe" "%LocalDir%\regini.txt" 927 | echo C:\Windows\SysWOW64\regini.exe "%LocalDir%\regini.txt" >>%log% 928 | 929 | :: ------------------ 930 | 931 | :: Log 932 | echo !date! !time!- Setting CSC to clear >>%log% 933 | 934 | :: Clear cached network share files in CSC 935 | REG ADD "HKLM\System\CurrentControlSet\Services\CSC\Parameters" /v FormatDatabase /t REG_DWORD /d 1 /f >>%log% 936 | 937 | :: ------------------ 938 | 939 | :: Associate .VBS to correct handler 940 | assoc .vbs=VBSFile 941 | cscript.exe //H:WScript 942 | REG ADD "HKCR\.vbs" /ve /d VBSfile /f 943 | 944 | :: ------------------ 945 | 946 | :: Log 947 | echo !date! !time!- Syncing time >>%log% 948 | 949 | :: Sync time regardless of network location 950 | sc config w32time start= auto 951 | net stop w32time 952 | w32tm /config /syncfromflags:manual /manualpeerlist:"time.google.com" 953 | net start w32time 954 | w32tm /resync /nowait 955 | 956 | :: ------------------ 957 | 958 | :: Log 959 | echo !date! !time!- Repairing WMI if required >>%log% 960 | 961 | :: Test and repair WMI 962 | WMIC timezone >NUL 963 | if not !ERRORLEVEL!==0 ( 964 | echo !date! !time!- Repairing WMI >>%log% 965 | call util\repair_wmi.bat 966 | echo !date! !time!- Repairing WMI - Complete >>%log% 967 | ) 968 | @echo on 969 | 970 | :: ------------------ 971 | 972 | if "%wipe-2007%"=="1" ( 973 | 974 | :: Detect if Office 2007 is installed 975 | if exist "C:\Program Files (x86)\Microsoft Office\Office12\" ( 976 | 977 | :: Wipe Office 2007 978 | echo !date! !time!- Wiping Office2007 >>%log% 979 | start "" /b /wait "cscript.exe" "%LocalDir%\OffScrub07.vbs" %EDITIONS% /K 980 | echo !date! !time!- Wiping Office2007 - Complete !ERRORLEVEL! >>%log% 981 | ) 982 | ) 983 | 984 | if "%wipe-2010%"=="1" ( 985 | 986 | :: Detect if Office 2010 is installed 987 | if exist "C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.exe" ( 988 | 989 | :: Wipe Office 2010 990 | echo !date! !time!- Wiping Office2010 >>%log% 991 | start "" /b /wait "cscript.exe" "%LocalDir%\OffScrub10.vbs" %EDITIONS% /K 992 | echo !date! !time!- Wiping Office2010 - Complete !ERRORLEVEL! >>%log% 993 | ) 994 | ) 995 | 996 | if "%wipe-2013%"=="1" ( 997 | 998 | :: Wipe Office 2013 999 | echo !date! !time!- Wiping Office2013 >>%log% 1000 | start "" /b /wait "cscript.exe" "%LocalDir%\OffScrub_O15msi.vbs" %EDITIONS% /K 1001 | echo !date! !time!- Wiping Office2013 - Complete !ERRORLEVEL! >>%log% 1002 | 1003 | ) 1004 | 1005 | if "%wipe-2016%"=="1" ( 1006 | 1007 | :: Detect if Office 2016 is installed 1008 | if exist "C:\Program Files (x86)\Microsoft Office\Office16\" ( 1009 | 1010 | :: Wipe Office 2016 1011 | echo !date! !time!- Wiping Office2016 >>%log% 1012 | start "" /b /wait "cscript.exe" "%LocalDir%\OffScrub_O16msi.vbs" %EDITIONS% /K 1013 | echo !date! !time!- Wiping Office2016 - Complete !ERRORLEVEL! >>%log% 1014 | ) 1015 | ) 1016 | 1017 | if "%wipe-c2r%"=="1" ( 1018 | 1019 | :: Detect if OfficeC2R is installed 1020 | if exist "C:\Program Files (x86)\Microsoft Office\root\" ( 1021 | 1022 | :: Wipe Office C2R 1023 | echo !date! !time!- Wiping OfficeC2R >>%log% 1024 | start "" /b /wait "cscript.exe" "%LocalDir%\OffScrubc2r.vbs" /Log %LOCALDIR% 1025 | echo !date! !time!- Wiping OfficeC2R - Complete !ERRORLEVEL! >>%log% 1026 | ) 1027 | 1028 | ) 1029 | 1030 | :: ------------------ 1031 | 1032 | :CONFIG-END 1033 | 1034 | :: ------------------ 1035 | 1036 | if "%clear-2007exe%"=="1" ( 1037 | :: Remove abandoned .EXE in root of "Microsoft Office" 1038 | del "C:\Program Files (x86)\Microsoft Office\*.exe" /f >>%logclean% 1039 | 1040 | :: Remove abandoned 2007 shortcuts from user profiles 1041 | del /q /f /s "C:\Users\*Office Excel 2007.lnk" >>%logclean% 1042 | del /q /f /s "C:\Users\*Office Outlook 2007.lnk" >>%logclean% 1043 | del /q /f /s "C:\Users\*Office Word 2007.lnk" >>%logclean% 1044 | 1045 | :: Remove abandoned 2007 shortcuts from Public profile 1046 | del /q /f /s "C:\ProgramData\Microsoft\Windows\Start Menu\*Office Excel 2007.lnk" >>%logclean% 1047 | del /q /f /s "C:\ProgramData\Microsoft\Windows\Start Menu\*Office Outlook 2007.lnk" >>%logclean% 1048 | del /q /f /s "C:\ProgramData\Microsoft\Windows\Start Menu\*Office Word 2007.lnk" >>%logclean% 1049 | ) 1050 | 1051 | :: ------------------ 1052 | 1053 | if "%install-Access2007%"=="1" ( 1054 | echo !date! !time!- Set to install Access2007 >>%log% 1055 | 1056 | :: Detect if Office2007x86 already installed 1057 | if not exist "C:\Program Files (x86)\Microsoft Office\Office12\MSACCESS.exe" ( 1058 | 1059 | :: Office2007x86 not installed, Install Access 2007 x86 - Trigger 1060 | echo !date! !time!- Installing Access2007x86 >>%log% 1061 | 1062 | :: Detect if install files are avaliable 1063 | if exist "%InstallDir%\Packages\Office_2007_ProPlus\2007-USS-accessonly.MSP" ( 1064 | 1065 | :: Install Access 2007 x86 1066 | start "" /b /wait "%InstallDir%\Packages\Office_2007_ProPlus\setup.exe" /adminfile "%InstallDir%\Packages\Office_2007_ProPlus\2007-USS-accessonly.MSP" 1067 | echo !date! !time!- Installing Access2007x86 - Complete !ERRORLEVEL! >>%log% 1068 | 1069 | ) 1070 | 1071 | ) ELSE ( 1072 | 1073 | :: If Office2007x86 already installed, remove and lock-out Office2007x86, other than Access 1074 | echo !date! !time!- Locking out Office2007NonAccess - Trigger >>%log% 1075 | 1076 | :: Detect if install files are avaliable 1077 | if exist "%InstallDir%\Packages\Office_2007_ProPlus\2007-USS-accessonly.MSP" ( 1078 | 1079 | :: Lock out Office2007x86, other than Access 1080 | start "" /b /wait "msiexec.exe" /p "%InstallDir%\Packages\Office_2007_ProPlus\2007-USS-accessonly.MSP" /passive /norestart 1081 | echo !date! !time!- Locking out Outlook2007 - Complete !ERRORLEVEL! >>%log% 1082 | ) 1083 | 1084 | ) 1085 | 1086 | ) 1087 | 1088 | :: ------------------ 1089 | 1090 | if "%install-Office2007%"=="1" ( 1091 | echo !date! !time!- Set to install Office2007 >>%log% 1092 | 1093 | :: Detect if Office2007x86 already installed 1094 | if not exist "C:\Program Files (x86)\Microsoft Office\Office12\GRAPH.exe" ( 1095 | 1096 | :: Install Office 2007 ProPlus x86 1097 | echo !date! !time!- Installing Office2007 >>%log% 1098 | start "" /b /wait "%InstallDir%\Packages\Office_2007_ProPlus\setup.exe" /adminfile "%InstallDir%\Packages\Office_2007_ProPlus\2007-uss-neo.MSP" 1099 | echo !date! !time!- Installing Office2007 - Complete !ERRORLEVEL! >>%log% 1100 | ) 1101 | 1102 | :: Only patch is Office 2007 ProPlus x86 installed 1103 | if exist "C:\Program Files (x86)\Microsoft Office\Office12\GRAPH.exe" ( 1104 | echo !date! !time!- Office2007 install files detected >>%log% 1105 | 1106 | :: Skip patching Office 2007 ProPlus x86 if option set 1107 | if not "%skip-patch2007%"=="1" ( 1108 | echo !date! !time!- Set to patch Office2007 >>%log% 1109 | 1110 | :: Patch Office 2007 1111 | echo !date! !time!- Patching Office2007 >>%log% 1112 | FOR /F %%G in ('dir /b "%InstallDir%\Packages\Updates-Office2007\*.exe"') do ( 1113 | echo !date! !time!- Installing update: %%G >>%log% 1114 | start "" /b /wait "%InstallDir%\Packages\Updates-Office2007\%%G" /passive /norestart /quiet 1115 | ) 1116 | FOR /F %%G in ('dir /b "%InstallDir%\Packages\Updates-Office2007\*.msp"') do ( 1117 | echo !date! !time!- Installing update: %%G >>%log% 1118 | start "" /b /wait msiexec /p "%InstallDir%\Packages\Updates-Office2007\%%G" /qn /norestart) 1119 | ) 1120 | echo !date! !time!- Patching Office2007 - Complete !ERRORLEVEL! >>%log% 1121 | ) 1122 | ) 1123 | ) 1124 | 1125 | :: ------------------ 1126 | 1127 | if "%install-Office2013PP%"=="1" ( 1128 | echo !date! !time!- Set to install Office2013PP >>%log% 1129 | 1130 | :: Remove Office 2007 Export to PDF since it won't be needed 1131 | start "" /b /wait "MsiExec.exe" /X{90120000-00B2-0409-0000-0000000FF1CE} /qn /norestart REBOOT=ReallySuppress 1132 | 1133 | :: Detect if Office 2013 ProPlus SP1 x86 is already installed 1134 | if not exist "C:\Program Files (x86)\Microsoft Office\Office15\EXCEL.exe" ( 1135 | 1136 | :: Install Office 2013 ProPlus SP1 1137 | echo !date! !time!- Installing Office2013PP >>%log% 1138 | start "" /b /wait "%InstallDir%\Packages\Office_2013_ProPlus_SP1_x86\setup.exe" /adminfile "%InstallDir%\Packages\Office_2013_ProPlus_SP1_x86\2013-uss.MSP" 1139 | echo !date! !time!- Installing Office2013PP - Complete !ERRORLEVEL! >>%log% 1140 | ) 1141 | 1142 | :: Patch Office 2013 1143 | echo !date! !time!- Patching Office2013 >>%log% 1144 | FOR /F %%G in ('dir /b "%InstallDir%\Packages\Updates-Office2013\*.msp"') do (start "" /b /wait msiexec /p "%InstallDir%\Packages\Updates-Office2013\%%G" /qn /norestart) 1145 | echo !date! !time!- Patching Office2013 - Complete !ERRORLEVEL! >>%log% 1146 | ) 1147 | 1148 | :: ------------------ 1149 | 1150 | if "%install-SkypeForBusiness2016Basic%"=="1" ( 1151 | echo !date! !time!- Set to install S4B >>%log% 1152 | 1153 | :: Detect if S4B x86 is already installed 1154 | if not exist "C:\Program Files (x86)\Microsoft Office\Office16\lync.exe" ( 1155 | 1156 | :: Install Skype for Business 2016 Basic x86 1157 | echo !date! !time!- Installing S4B Basic x86 >>%log% 1158 | if exist "%InstallDir%\Packages\SkypeForBusiness2016Basic\setup.exe" ( 1159 | start "" /b /wait "%InstallDir%\Packages\SkypeForBusiness2016Basic\setup.exe" /adminfile "%InstallDir%\Packages\SkypeForBusiness2016Basic\2016-uss.MSP" 1160 | echo !date! !time!- Installing S4B Basic x86 - Complete !ERRORLEVEL! >>%log% 1161 | ) 1162 | 1163 | ) 1164 | 1165 | ) 1166 | 1167 | :: ------------------ 1168 | 1169 | if "%install-Access2016%"=="1" ( 1170 | echo !date! !time!- Set to install Access 2016 x86 >>%log% 1171 | 1172 | :: Uninstall Access Runtime 2007 1173 | msiexec.exe /x {90120000-001C-0409-0000-0000000FF1CE} /qn /norestart 1174 | 1175 | :: Remove and lock-out Access 2007 1176 | echo !date! !time!- Locking out Access2007 >>%log% 1177 | if exist "%InstallDir%\Packages\Access_2016_x86\2007-removeaccess.MSP" ( 1178 | start "" /b /wait "msiexec.exe" /p "%InstallDir%\Packages\Access_2016_x86\2007-removeaccess.MSP" /passive /norestart 1179 | echo !date! !time!- Locking out Access2007 - Complete !ERRORLEVEL! >>%log% 1180 | ) 1181 | 1182 | :: Detect if Access 2007 Runtime is potentially installed 1183 | if exist "C:\Program Files (x86)\Microsoft Office\Office12\MSACCESS.EXE" ( 1184 | 1185 | :: Wipe Access 2007 Runtime 1186 | echo !date! !time!- Wiping Access2007Runtime >>%log% 1187 | start "" /b /wait "cscript.exe" "%LocalDir%\OffScrub07.vbs" Access,AccessRuntime,AccessRT,ACE /SkipShortcutDetection /Log %LOCALDIR% 1188 | echo !date! !time!- Wiping Access2007Runtime - Complete !ERRORLEVEL! >>%log% 1189 | ) 1190 | 1191 | :: Uninstall Access database engine 2010 1192 | msiexec.exe /x {90140000-00D1-0409-0000-0000000FF1CE} /passive /norestart 1193 | 1194 | :: Detect if Access 2010 Runtime is installed 1195 | if exist "C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE" ( 1196 | 1197 | :: Wipe Access 2010 Runtime 1198 | echo !date! !time!- Wiping Access2010Runtime >>%log% 1199 | start "" /b /wait "cscript.exe" "%LocalDir%\OffScrub10.vbs" Access,AccessRuntime,AccessRT,ACE /SkipShortcutDetection /Log %LOCALDIR% 1200 | echo !date! !time!- Wiping Access2010Runtime - Complete !ERRORLEVEL! >>%log% 1201 | ) 1202 | 1203 | :: Detect if Access 2013 Runtime is installed 1204 | if exist "C:\Program Files (x86)\Microsoft Office\Office15\MSACCESS.EXE" ( 1205 | 1206 | :: Wipe Access 2013 Runtime 1207 | echo !date! !time!- Wiping Access2013Runtime >>%log% 1208 | start "" /b /wait "cscript.exe" "%LocalDir%\OffScrub_O15msi.vbs" Access,AccessRuntime,AccessRT,ACE /SkipSD /Log %LOCALDIR% 1209 | echo !date! !time!- Wiping Access2013Runtime - Complete !ERRORLEVEL! >>%log% 1210 | ) 1211 | 1212 | :: Detect if Access 2016 Runtime is installed 1213 | if exist "C:\Program Files (x86)\Microsoft Office\Office16\MSACCESS.EXE" ( 1214 | 1215 | :: Wipe Access 2016 Runtime 1216 | echo !date! !time!- Wiping Access2016Runtime >>%log% 1217 | start "" /b /wait "cscript.exe" "%LocalDir%\OffScrub_O16msi.vbs" Access,AccessRuntime,AccessRT,ACE /SkipSD /Log %LOCALDIR% 1218 | echo !date! !time!- Wiping Access2016Runtime - Complete !ERRORLEVEL! >>%log% 1219 | ) 1220 | 1221 | :: Install Access 2016 x86 1222 | echo !date! !time!- Installing Access 2016 x86 >>%log% 1223 | start "" /b /wait "%InstallDir%\Packages\Access_2016_x86\setup.exe" /adminfile "%InstallDir%\Packages\Access_2016_x86\2016access.MSP" 1224 | echo !date! !time!- Installing Access 2016 x86 - Complete !ERRORLEVEL! >>%log% 1225 | 1226 | :: Make sure ACCDR is mapped correctly and doesn't revert back to Access 2007 1227 | reg delete "HKCU\Software\Classes\.accdr" /f 1228 | reg delete "HKCU\Software\Classes\Access.ACCDRFile.12" /f 1229 | reg delete "HKLM\Software\Classes\Access.ACCDRFile.12" /f 1230 | 1231 | reg add "HKLM\Software\Classes\.accdr" /ve /d Access.ACCDRFile.16 /t REG_SZ /f 1232 | reg add "HKLM\Software\Classes\.accdr" /v "Content Type" /d application/msaccess /t REG_SZ /f 1233 | 1234 | REM HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Access.MDBFile\shell\Open\command 1235 | 1236 | ) 1237 | 1238 | :: ------------------ 1239 | 1240 | if "%install-Access2016Runtime%"=="1" ( 1241 | echo !date! !time!- Set to install Access 2016 Runtime x86 >>%log% 1242 | 1243 | :: Install Access 2016 Runtime x86 1244 | echo !date! !time!- Installing Access 2016 Runtime x86 >>%log% 1245 | start "" /b /wait "%InstallDir%\Packages\Access2016Runtime\setup.exe" /config "%InstallDir%\Packages\Access2016Runtime\config.xml" 1246 | echo !date! !time!- Installing Access Runtime - Complete !ERRORLEVEL! >>%log% 1247 | 1248 | ) 1249 | 1250 | :: ------------------ 1251 | 1252 | if "%install-Office2016Std%"=="1" ( 1253 | echo !date! !time!- Set to install Office2016Stdx86 >>%log% 1254 | 1255 | :: Remove Office 2007 Export to PDF since it won't be needed 1256 | start "" /b /wait "MsiExec.exe" /X{90120000-00B2-0409-0000-0000000FF1CE} /qn /norestart REBOOT=ReallySuppress 1257 | 1258 | :: Detect if Office 2016 x86 is already installed 1259 | if not exist "C:\Program Files (x86)\Microsoft Office\Office16\EXCEL.exe" ( 1260 | 1261 | :: Install Office 2016 Standard x86 1262 | echo !date! !time!- Installing Office2016Stdx86 >>%log% 1263 | start "" /b /wait "%InstallDir%\Packages\Office_2016_Std_x86\setup.exe" /adminfile "%InstallDir%\Packages\Office_2016_Std_x86\2016office.MSP" 1264 | echo !date! !time!- Installing Office2016Stdx86 - Complete !ERRORLEVEL! >>%log% 1265 | ) 1266 | 1267 | ) 1268 | 1269 | :: ------------------ 1270 | 1271 | if "%install-Outlook2016%"=="1" ( 1272 | echo !date! !time!- Set to install Outlook2016x86 >>%log% 1273 | 1274 | :: Detect if Outlook 2016 already installed 1275 | if not exist "C:\Program Files (x86)\Microsoft Office\Office16\outlook.exe" ( 1276 | 1277 | :: Remove and lock-out Outlook 2007 1278 | echo !date! !time!- Locking out Outlook2007 >>%log% 1279 | if exist "%InstallDir%\Packages\Outlook_2016_Std_x86\2007-removeoutlook.MSP" ( 1280 | start "" /b /wait "msiexec.exe" /p "%InstallDir%\Packages\Outlook_2016_Std_x86\2007-removeoutlook.MSP" /passive /norestart 1281 | echo !date! !time!- Locking out Outlook2007 - Complete !ERRORLEVEL! >>%log% 1282 | ) 1283 | 1284 | :: Install Outlook 2016 1285 | echo !date! !time!- Installing Outlook2016x86 >>%log% 1286 | if exist "%InstallDir%\Packages\Outlook_2016_Std_x86\setup.exe" ( 1287 | start "" /b /wait "%InstallDir%\Packages\Outlook_2016_Std_x86\setup.exe" /adminfile "%InstallDir%\Packages\Outlook_2016_Std_x86\2016outlook.MSP" 1288 | echo !date! !time!- Installing Outlook2016x86 - Complete !ERRORLEVEL! >>%log% 1289 | ) 1290 | 1291 | ) 1292 | 1293 | :: Add WINWORD.EXE to the Office2016 folder to unlock Proofing tools and Picture formatting 1294 | if not exist "C:\Program Files (x86)\Microsoft Office\Office16\WINWORD.exe" ( 1295 | xcopy "C:\Program Files (x86)\Microsoft Office\Office12\WINWORD.exe" "C:\Program Files (x86)\Microsoft Office\Office16\" /Y >>%log% 1296 | xcopy "C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.exe" "C:\Program Files (x86)\Microsoft Office\Office16\" /Y >>%log% 1297 | xcopy "C:\Program Files (x86)\Microsoft Office\Office15\WINWORD.exe" "C:\Program Files (x86)\Microsoft Office\Office16\" /Y >>%log% 1298 | ) 1299 | 1300 | :: Remove Outlook 2007 shortcuts 1301 | DEL /F /S /Q "C:\Users\*Outlook 2007*.lnk" >>%logclean% 1302 | DEL /F /S /Q "C:\ProgramData\Microsoft\*Outlook 2007*.lnk" >>%logclean% 1303 | 1304 | ) 1305 | 1306 | :: ------------------ 1307 | 1308 | if "%install-Visio2016Viewer%"=="1" ( 1309 | echo !date! !time!- Set to install VisioViewerx86 >>%log% 1310 | 1311 | :: Install Visio 2016 Viewer 1312 | echo !date! !time!- Installing VisioViewerx86 >>%log% 1313 | if exist "%InstallDir%\Packages\Visio2016Viewer\visioviewer_4339-1001_x86_en-us.exe" ( 1314 | start "" /b /wait "%InstallDir%\Packages\Visio2016Viewer\visioviewer_4339-1001_x86_en-us.exe" /passive /norestart /quiet 1315 | echo !date! !time!- Installing VisioViewerx86 - Complete !ERRORLEVEL! >>%log% 1316 | ) 1317 | 1318 | ) 1319 | 1320 | :: ------------------ 1321 | 1322 | :: Install JunkReportingAddinx86 1323 | echo !date! !time!- Installing JunkReporterx86 >>%log% 1324 | if exist "%InstallDir%\Packages\JunkReportingAddinx86\JunkReportingAddinx86.msi" ( 1325 | start "" /b /wait "msiexec.exe" /i "%InstallDir%\Packages\JunkReportingAddinx86\JunkReportingAddinx86.msi" /passive /norestart REBOOT=ReallySuppress MSIRESTARTMANAGERCONTROL="DisableShutdown" MaxMessageSelection=30 BccEmailAddress="junkreports-COMPANY@COMPANY.com" 1326 | echo !date! !time!- Installing JunkReporterx86 - Complete !ERRORLEVEL! >>%log% 1327 | ) 1328 | 1329 | :: ------------------ 1330 | 1331 | :: Skip patching Office 2016 if option set 1332 | if not "%skip-patch2016%"=="1" ( 1333 | echo !date! !time!- Set to patch Office2007 >>%log% 1334 | 1335 | :: Patch Office 2016 1336 | echo !date! !time!- Patching Office2016x86 >>%log% 1337 | FOR /F %%G in ('dir /b "%InstallDir%\Packages\Updates-Office2016\*.msp"') do ( 1338 | echo !date! !time!- Installing update: %%G >>%log% 1339 | start "" /b /wait msiexec /p "%InstallDir%\Packages\Updates-Office2016\%%G" /qn /norestart 1340 | echo !date! !time!- Update errorlevel: !ERRORLEVEL! >>%log% 1341 | ) 1342 | FOR /F %%G in ('dir /b "%InstallDir%\Packages\Updates-Office2016\*.exe"') do ( 1343 | echo !date! !time!- Installing update: %%G >>%log% 1344 | start "" /b /wait "%InstallDir%\Packages\Updates-Office2016\%%G" /passive /norestart 1345 | ) 1346 | 1347 | echo !date! !time!- Patching Office2016x86 - Complete >>%log% 1348 | ) 1349 | 1350 | :: ------------------ 1351 | 1352 | :: Restart explorer.exe after grove updates 1353 | if not "%reboot%"=="reboot" ( 1354 | start "" /b "explorer.exe" 1355 | ) 1356 | 1357 | :: ------------------ 1358 | 1359 | :: Activate software 1360 | echo !date! !time!- Activating Office >>%log% 1361 | 1362 | if exist "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.vbs" ( 1363 | start "" /b /wait "cscript.exe" "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.vbs" /act 1364 | ) 1365 | if exist "C:\Program Files\Microsoft Office\Office16\OSPP.vbs" ( 1366 | start "" /b /wait "cscript.exe" "C:\Program Files\Microsoft Office\Office16\OSPP.vbs" /act 1367 | ) 1368 | 1369 | :: ------------------ 1370 | 1371 | :: Install EMET 5.52 1372 | :: Per-app config controlled by Group Policy 1373 | echo !date! !time!- Installing EMET >>%log% 1374 | 1375 | if exist "%InstallDir%\Packages\EMET\EMETSetup_5.52.msi" ( 1376 | start "" /b /wait msiexec /i "%InstallDir%\Packages\EMET\EMETSetup_5.52.msi" /passive /norestart 1377 | echo !date! !time!- Installing EMET - Complete !ERRORLEVEL! >>%log% 1378 | ) 1379 | if exist "C:\Program Files (x86)\EMET 5.5\EMET_Conf.exe" ( 1380 | start "" /b /wait "C:\Program Files (x86)\EMET 5.5\EMET_Conf.exe" --delete_all >>%log% 1381 | start "" /b /wait "C:\Program Files (x86)\EMET 5.5\EMET_Conf.exe" --reporting +telemetry +eventlog +trayicon >>%log% 1382 | start "" /b /wait "C:\Program Files (x86)\EMET 5.5\EMET_Conf.exe" --exploitaction stop >>%log% 1383 | start "" /b /wait "C:\Program Files (x86)\EMET 5.5\EMET_Conf.exe" --system Pinning=Disabled >>%log% 1384 | start "" /b /wait "C:\Program Files (x86)\EMET 5.5\EMET_Conf.exe" --deephooks enabled >>%log% 1385 | start "" /b /wait "C:\Program Files (x86)\EMET 5.5\EMET_Conf.exe" --antidetours enabled >>%log% 1386 | start "" /b /wait "C:\Program Files (x86)\EMET 5.5\EMET_Conf.exe" --bannedfunc enabled >>%log% 1387 | ) 1388 | 1389 | :: ------------------ 1390 | 1391 | :: Install OneDrive machine-wide 1392 | echo !date! !time!- Installing OneDrive >>%log% 1393 | 1394 | if exist "%InstallDir%\Packages\OneDrive\OneDriveSetup.exe" ( 1395 | start "" /b /wait "%InstallDir%\Packages\OneDrive\OneDriveSetup.exe" /silent /PerComputer 1396 | echo !date! !time!- Installing OneDrive - Complete !ERRORLEVEL! >>%log% 1397 | ) 1398 | 1399 | :: ------------------ 1400 | 1401 | :: DisableProgramTelemetry2 1402 | schtasks /change /TN "\Microsoft\Windows\Application Experience\Microsoft Compatibility Appraiser" /DISABLE 1403 | schtasks /change /TN "\Microsoft\Windows\Application Experience\ProgramDataUpdater" /DISABLE 1404 | schtasks /change /TN "\Microsoft\Windows\Application Experience\StartupAppTask" /DISABLE 1405 | schtasks /change /TN "\Microsoft\Windows\Application Experience\AitAgent" /DISABLE 1406 | schtasks /change /TN "\Microsoft\Windows\WindowsBackup\ConfigNotification" /DISABLE 1407 | schtasks /change /TN "\Microsoft\Windows\RemoteAssistance\RemoteAssistanceTask" /DISABLE 1408 | wevtutil sl AirSpaceChannel /e:false 1409 | wevtutil cl AirSpaceChannel 1410 | 1411 | reg add "HKCU\Software\Policies\Microsoft\Windows\AppCompat" /v DisablePCA /t REG_DWORD /d 1 /f 1412 | reg add "HKLM\Software\Policies\Microsoft\Windows\AppCompat" /v DisableUAR /t REG_DWORD /d 1 /f 1413 | reg add "HKLM\Software\Policies\Microsoft\Windows\AppCompat" /v AITEnable /t REG_DWORD /d 0 /f 1414 | reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience/Program-Telemetry" /v Enabled /t REG_DWORD /d 0 /f 1415 | reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience/Program-Compatibility-Assistant" /v Enabled /t REG_DWORD /d 0 /f 1416 | reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience/Program-Compatibility-Troubleshooter" /v Enabled /t REG_DWORD /d 0 /f 1417 | reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience/Program-Inventory" /v Enabled /t REG_DWORD /d 0 /f 1418 | 1419 | :: ------------------ 1420 | 1421 | :: DisableNetbios 1422 | echo !date! !time!- Disabling NetBIOS >>%log% 1423 | 1424 | powershell.exe -command "& {set-ItemProperty HKLM:\SYSTEM\CurrentControlSet\services\NetBT\Parameters\Interfaces\tcpip* -Name NetbiosOptions -Value 2}" 1425 | 1426 | :: ------------------ 1427 | 1428 | :: UnInstallCCTK 1429 | :: Prepare for updating to new version 1430 | 1431 | :: Check if Dell hardware 1432 | if "%HWOEM%"=="Dell" ( 1433 | echo UnInstalling Dell Client Configuration Toolkit 1434 | echo !date! !time!- UnInstalling Dell Client Configuration Toolkit >>%log% 1435 | 1436 | ::Remove 1437 | set LPATH="%WINDIR%\CCTK\X86" 1438 | if defined ProgramFiles^(x86^) set LPATH="%WINDIR%\CCTK\X86_64" 1439 | cd !LPATH! 1440 | call "HAPI\HAPIUninstall.bat" 1441 | del /q /f /s "%WINDIR%\CCTK\*.*" 1442 | if "%EchoMode%"=="echo" echo on 1443 | ) 1444 | 1445 | cd %LOCALDIR% 1446 | 1447 | :: ------------------ 1448 | 1449 | :: InstallCCTK 1450 | :: Allows control of Dell BIOS settings 1451 | echo !date! !time!- Installing CCTK >>%log% 1452 | 1453 | :: Check if Dell hardware 1454 | if "%HWOEM%"=="Dell" ( 1455 | echo Installing Dell Client Configuration Toolkit 1456 | 1457 | :: Drop CCTK in Windir 1458 | start "" /b /wait "%InstallDir%\Packages\DellBios\7za.exe" x -o%WINDIR% -y "%InstallDir%\Packages\DellBios\CCTK.zip" >>%log% 1459 | set LPATH="%WINDIR%\CCTK\X86" 1460 | if defined ProgramFiles^(x86^) set LPATH="%WINDIR%\CCTK\X86_64" 1461 | cd !LPATH! 1462 | call "HAPI\HAPIInstall.bat" 1463 | if "%EchoMode%"=="echo" echo on 1464 | ) 1465 | 1466 | cd %LOCALDIR% 1467 | 1468 | :: ------------------ 1469 | 1470 | :: BIOS unlock 1471 | 1472 | :: Check if Dell hardware 1473 | if "%HWOEM%"=="Dell" ( 1474 | echo !date! !time!- Unlocking BIOS >>%log% 1475 | set LPATH="%WINDIR%\CCTK\X86" 1476 | if defined ProgramFiles^(x86^) set LPATH="%WINDIR%\CCTK\X86_64" 1477 | cd !LPATH! 1478 | echo +Removing BIOS setup password temporarily 1479 | cctk --valsetuppwd=00000 --setuppwd= >>%log% 1480 | if "%EchoMode%"=="echo" echo on 1481 | ) 1482 | 1483 | :: Return to root installer folder 1484 | cd %LOCALDIR% 1485 | 1486 | :: ------------------ 1487 | 1488 | :: Restore services and tasks 1489 | REM This is done before the driver installation in case it bluescreens. 1490 | echo !date! !time!- Restoring services >>%log% 1491 | 1492 | sc config wuauserv start= delayed-auto 1493 | sc config bits start= delayed-auto 1494 | sc config wsearch start= delayed-auto 1495 | sc config ClickToRunSvc start= delayed-auto 1496 | schtasks /change /TN "\Microsoft\Office\Office Automatic Updates" /ENABLE 1497 | 1498 | :: ------------------ 1499 | 1500 | :: Update drivers for Office 2016 hardware acceleration compatibility 1501 | 1502 | :: Intel Chipset 1503 | echo !date! !time!- Installing Intel Chipset >>%log% 1504 | :: Intel-Chipset-Install 1505 | if exist "%InstallDir%\Packages\Intel\SetupChipset.exe" ( 1506 | start "" /b /wait "%InstallDir%\Packages\Intel\SetupChipset.exe" -s -norestart 1507 | echo !date! !time!- Installing Intel Chipset - Complete !ERRORLEVEL! >>%log% 1508 | ) 1509 | 1510 | :: Check if nVidia mobile 1511 | if "%VIDEO%"=="NVMOBILE" ( 1512 | echo !date! !time!- Installing nVidia mobile drivers >>%log% 1513 | :: NVMOBILE-Install 1514 | if exist "%InstallDir%\Packages\NVMOBILE\390.65-desktop-win8-win7-64bit-international-whql.exe" ( 1515 | start "" /b /wait "%InstallDir%\Packages\NVMOBILE\390.65-desktop-win8-win7-64bit-international-whql.exe" -s -n 1516 | echo !date! !time!- Installing Installing nVidia mobile drivers - Complete !ERRORLEVEL! >>%log% 1517 | ) 1518 | ) 1519 | 1520 | :: Check if Dell hardware 1521 | if "%HWOEM%"=="Dell" ( 1522 | echo !date! !time!- Installing DCU >>%log% 1523 | :: DCU-Install 1524 | if exist "%InstallDir%\Packages\DellCommandUpdate\Dell-Command-Update_X79N4_WIN_2.3.1_A00.EXE" ( 1525 | start "" /b /wait "%InstallDir%\Packages\DellCommandUpdate\Dell-Command-Update_X79N4_WIN_2.3.1_A00.EXE" /s >>%log% 1526 | ) 1527 | 1528 | :: DCU-Update 1529 | echo Running Dell Command Update 1530 | echo !date! !time!- Running DCU update >>%log% 1531 | start "" /b /wait "C:\Program Files (x86)\Dell\CommandUpdate\dcu-cli.exe" /log "c:\install" 1532 | 1533 | if "%EchoMode%"=="echo" echo on 1534 | ) 1535 | 1536 | :: Return to root installer folder 1537 | cd %LOCALDIR% 1538 | 1539 | :: ------------------ 1540 | 1541 | :: Brand BIOS and configure proper settings 1542 | 1543 | :: Check if Dell hardware 1544 | if "%HWOEM%"=="Dell" ( 1545 | 1546 | :: Older method 1547 | set LPATH="%WINDIR%\CCTK\X86 1548 | if defined ProgramFiles^(x86^) set LPATH="%WINDIR%\CCTK\X86_64" 1549 | cd !LPATH! 1550 | echo !date! !time!- Branding BIOS >>%log% 1551 | echo +Branding BIOS 1552 | cctk --propowntag="If found please call" >nul 2>&1 1553 | cctk --asset=COMPANY >nul 2>&1 1554 | 1555 | :: Newer method 1556 | start "" /b /wait "%InstallDir%\Packages\DellBios\PlatformTags32W.exe" SOT:"Owned by COMPANY." 1557 | start "" /b /wait "%InstallDir%\Packages\DellBios\PlatformTags32W.exe" SAT:"COMPANY" 1558 | 1559 | cd !LPATH! 1560 | 1561 | echo +Enabling CPU eXecute Disable ^(XD^) feature support 1562 | cctk --cpuxdsupport=enable >nul 2>&1 1563 | echo +Enabling virtualization 1564 | cctk --virtualization=enable >nul 2>&1 1565 | echo +Enabling VT for Direct I/O 1566 | cctk --vtfordirectio=on >nul 2>&1 1567 | echo +Enabling Wake On Lan ^(WOL^) 1568 | cctk --wakeonlan=enable >nul 2>&1 1569 | cctk --wakeonlanbootovrd=enable >nul 2>&1 1570 | echo +Setting built-in NIC status to PXE 1571 | cctk --embnic1=on >nul 2>&1 1572 | echo +Enabling USB powershare 1573 | cctk --usbpowershare=enable >nul 2>&1 1574 | echo +Setting fastboot 1575 | cctk --fastboot=automatic >nul 2>&1 1576 | echo +Enabling SMART errors 1577 | cctk --smarterrors=enable >nul 2>&1 1578 | echo +Enabling HD free fall protection 1579 | cctk --hdfreefallprotect=enable >nul 2>&1 1580 | echo +Enabling BIOS update signature verification 1581 | cctk --sfuenabled=yes >nul 2>&1 1582 | cctk --chasintrustatus=tripreset >nul 2>&1 1583 | echo +Configuring CPU performance 1584 | cctk --cpucore=all >nul 2>&1 1585 | cctk --cpuxdsupport=enable >nul 2>&1 1586 | cctk --cstatesctrl=enable >nul 2>&1 1587 | cctk --speedstep=automatic >nul 2>&1 1588 | cctk --turbomode=enable >nul 2>&1 1589 | cctk --postmebxkey=on >nul 2>&1 1590 | cctk --biosautorecovery=enable >nul 2>&1 1591 | cctk --biosdowngrade=disable >nul 2>&1 1592 | echo +Clear BIOS log on next boot 1593 | cctk --bioslogclear=enable >nul 2>&1 1594 | echo +Expose all options in BIOS setup 1595 | cctk --biossetupadvmode=enable >nul 2>&1 1596 | echo +Clear Fault Tolerant Memory Log on next boot 1597 | cctk --faulttolerantmemlogclear=enable 1598 | echo +Keyboard backlight timeout on AC to 1min 1599 | cctk --kbdbacklighttimeoutac=1m 1600 | echo +Clear Power Event Log on next boot 1601 | cctk --powerlogclear=enable 1602 | ) 1603 | 1604 | :: Return to root installer folder 1605 | cd %LOCALDIR% 1606 | 1607 | :: ------------------ 1608 | 1609 | :: Enroll in Microsoft Update 1610 | echo !date! !time!- Enroll in Microsoft Update >>%log% 1611 | 1612 | start "" /b /wait "cscript.exe" "%LocalDir%\MicrosoftUpdate.vbs" 1613 | 1614 | :: ------------------ 1615 | 1616 | echo !date! !time!- Updating Group Policy >>%log% 1617 | 1618 | :: Update computer and user Kerberos ticket 1619 | klist -li 0x3e7 purge >>%log% 1620 | klist purge >>%log% 1621 | 1622 | :: Restore any removed Group Policy settings 1623 | gpupdate /force >>%log% 1624 | 1625 | :: ------------------ 1626 | 1627 | echo installoffice2016.bat finish !date! !time!>>%log% 1628 | echo installoffice2016.bat finish !date! !time!>>c:\install\office2016.txt 1629 | 1630 | :: ------------------ 1631 | 1632 | :: Reboot if flag passed at runtime 1633 | if "%reboot%"=="reboot" ( 1634 | start "" /b "shutdown.exe" /f /r /t 30 1635 | ) 1636 | 1637 | :End 1638 | exit 1639 | 1640 | :Error 1641 | :Error-Restricted 1642 | echo. 1643 | echo Message: Office is already installed. 1644 | echo. 1645 | echo. 1646 | pause 1647 | exit --------------------------------------------------------------------------------