setlocal REM Set variables to network-accessible locations containing the Office source files. :: ALL PCs DEFAULT REM Set LogLocation to a central directory to collect log files. set LogLocation=\\domain\apps\Public\General\MicrosoftOffice_2013_ProPlus_x86\LogFiles REM Set location of file for install check set OfficeExe="C:\Program Files (x86)\Microsoft Office\Office15\winword.exe" REM Set Office 2010 source location for uninstall purposes set DeployServer2010=\\domain\apps\Public\General\MicrosoftOffice_2010_ProPlus_x86 set DeployServer=\\domain\apps\Public\General\MicrosoftOffice_2013_ProPlus_x86 REM Set Office 2013 source location for install purposes set Configfile2010=\\domain\apps\Public\General\MicrosoftOffice_2010_ProPlus_x86\_Opus\SilentUninstall2.xml set MSPfile=\\domain\apps\Public\General\MicrosoftOffice_2013_ProPlus_x86\_Opus\1_Full_Opus_Install_Or_Upgrade.MSP set Uninstall2013Config=\\domain\apps\Public\General\MicrosoftOffice_2013_ProPlus_x86\_Opus\SilentUninstall.xml :: LE PCs REM Perform check on PC for gateway, if false assume Default variables are good and proceed with next step ipconfig | find "192.168.7.1" if errorlevel 1 GOTO Office2013Installed REM Set Office 2010 source location for uninstall purposes set DeployServer2010=\\branch1\apps$\microsoft\MicrosoftOffice_2010_ProPlus_x86 set DeployServer=\\branch1\apps$\microsoft\MicrosoftOffice_2013_ProPlus_x86 REM Set Office 2013 source location for install purposes set Configfile2010=\\branch1\apps$\microsoft\MicrosoftOffice_2010_ProPlus_x86\_Opus\SilentUninstall2.xml set MSPfile=\\branch1\apps$\microsoft\MicrosoftOffice_2013_ProPlus_x86\_Opus\1_Full_Opus_Install_Or_Upgrade.MSP set Uninstall2013Config=\\branch1\apps$\microsoft\MicrosoftOffice_2013_ProPlus_x86\_Opus\SilentUninstall.xml :: TC PCs REM Perform check on PC for gateway, if false assume Default variables are good and proceed with next step ipconfig | find "192.168.9.1" if errorlevel 1 GOTO Office2013Installed REM Set Office 2010 source location for uninstall purposes set DeployServer2010=\\branch2\apps$\microsoft\office2010 set DeployServer=\\branch2\apps$\microsoft\office2013\x86 REM Set Office 2013 source location for install purposes set Configfile2010=\\branch2\apps$\microsoft\office2010\_Opus\SilentUninstall2.xml set MSPfile=\\branch2\apps$\microsoft\office2013\x86\_Opus\1_Full_Opus_Install_Or_Upgrade.MSP set Uninstall2013Config=\\branch2\apps$\microsoft\office2013\x86\_Opus\SilentUninstall.xml :: CP PCs REM Perform check on PC for gateway, if false assume Default variables are good and proceed with next step ipconfig | find "192.168.6.1" if errorlevel 1 GOTO Office2013Installed REM Set Office 2010 source location for uninstall purposes set DeployServer2010=\\branch3\apps$\microsoft\office2010 set DeployServer=\\branch3\apps$\microsoft\office2013\x86 REM Set Office 2013 source location for install purposes set Configfile2010=\\branch3\apps$\microsoft\office2010\_Opus\SilentUninstall2.xml set MSPfile=\\branch3\apps$\microsoft\office2013\x86\_Opus\1_Full_Opus_Install_Or_Upgrade.MSP set Uninstall2013Config=\\branch3\apps$\microsoft\office2013\x86\_Opus\SilentUninstall.xml REM ********************************************************************* REM Deployment code begins here. Do not modify anything below this line. REM ********************************************************************* :Office2013Installed REM Check to see if Office 2013 is already installed. If true, skip to End IF EXIST %OfficeExe% (goto End) :DeployOffice REM Set registry value for StatusScript to check REG ADD "HKLM\Software\CompanyName\PCSetup\Office2013Upgrade" /v InstallingStatus /t REG_DWORD /d 1 /f REM Uninstall Office 2010 Standard and Office 2007 compatibility pack MsiExec.exe /X{90120000-0020-0409-0000-0000000FF1CE} /q MsiExec.exe /X{90140000-0012-0000-0000-0000000FF1CE} /q REM Uninstall Office 2010 ProPlus start /wait %DeployServer2010%\setup.exe /uninstall ProPlus /config %Configfile2010% REM Uninstall Office 2013 Lync start /wait %DeployServer%\setup.exe /uninstall ProPlusR /config %Uninstall2013Config% REM Wait so that another install doesn't seem to be taking place timeout 30 REM Install Office 2013 start /wait %DeployServer%\setup.exe /adminfile %MSPfile% REM Write result of installation to LogFile for tracking purposes IF %errorlevel% == 0 ( echo %computername%,%date%,%time%,%errorlevel% >>%LogLocation%\Success.csv GOTO EndStatus ) IF %errorlevel% == 1641 ( echo %computername%,%date%,%time%,%errorlevel% >>%LogLocation%\Success.csv GOTO EndStatus ) IF %errorlevel% == 3010 ( echo %computername%,%date%,%time%,%errorlevel% >>%LogLocation%\Success.csv GOTO EndStatus ) echo %computername%,%date%,%time%,%errorlevel% >>%LogLocation%\Failure.csv GOTO EndStatus ::echo %date% %time% Setup ended with error code %errorlevel%. >> %LogLocation%\%computername%.txt :EndStatus REM Set registry value to signify that installation has ended REG ADD "HKLM\Software\CompanyName\PCSetup\Office2013Upgrade" /v InstallingStatus /t REG_DWORD /d 0 /f :End Endlocal