Microsoft Office 2007 Silent Install script

Microsoft Office 2007 Silent Install script

Microsoft Office 2007 silent install

Batch scripting procedures

To begin you must:

  1. 1. Create an Office customization MSP file. Follow the directions from Microsoft Technet.
  2. 2. Download bmail from Beyond Logic.
  3. 3. Change all the environmental variables stated at the beginning of the script to match your specific needs.*

* For instance, where SET MSP="Place UNC or local path of bmail.exe here in between the quotes" change "Place UNC or local path of bmail.exe here in between the quotes" to the appropriate location where you placed your *.msp file.

CLICK HERE TO DOWNLOAD THE SCRIPT BELOW

********** BATCH SCRIPT BEGINS **********



:: ******************************************************************

:: :: BATCH SCRIPT INSTALLER FOR OFFICE 2007

:: :: Created by Embraced Solutions

:: :: ******************************************************************



@ECHO OFF

Color A

TITLE Microsoft Office 2007 ******* DO NOT CLOSE THIS WINDOW *******

SET title="Microsoft Office 2007"

SET MSP="Place UNC or local path of .msp customization file here in between the quotes"

SET bmail="Place UNC or local path of bmail.exe here in between the quotes"

SET email="xyz@xyz.com"

SET FromAddress="%computername%@xyz.com"

SET SMTPserver="mail.xyz.com"

REM "successful and failed script executions are logged to the following location":

SET logfile="Office 2007 Install.log"



CLS

ECHO.



:: Check if already installed

ECHO Checking if Office 2007 is already installed

If Exist "C:\Program Files\Microsoft Office\Office12\Outlook.EXE" (

goto Uninstall

) else (

ECHO Preparing to install Microsoft Office 2007

)

:: End check



ECHO.



ECHO BEGAN %TIME%

:: Check if Office is currently running



SET Running=N

ECHO Checking if any Office Apps are running . . .

for /f "tokens=*" %%a in ('tasklist ^| findstr /i "WINWORD"') Do SET Running=Y

for /f "tokens=*" %%a in ('tasklist ^| findstr /i "EXCEL"') Do SET Running=Y

for /f "tokens=*" %%a in ('tasklist ^| findstr /i "MSACCESS"') Do SET Running=Y

for /f "tokens=*" %%a in ('tasklist ^| findstr /i "OUTLOOK"') Do SET Running=Y



If "%Running%"=="Y" (ECHO 7007 Return Code: %computername% - 2003 Office Apps are currently open. Installation cannot continue. %Date% at %time% >> %logfile%



exit /b

) else (

ECHO.

ECHO Office Apps are not currently running

)



:: End Check



ECHO.



:Install_Office

:: Deploy Office 07 using MSP customization file

ECHO.

ECHO Installing Microsoft Office 2007

start /w %title% "setup.exe" /adminfile "%MSP%"

If "%errorlevel%"=="0" (ECHO %errorlevel% Return Code: %computername% - Microsoft Office 2007 Upgrade successful. %Date% at %time% >> %logfile%



"%bmail%" -s %SMTPserver% -t %email% -f %FromAddress% -h -a "Office 2007 Installer Results" -b "%errorlevel% Return Code: %computername% - Microsoft Office 2007 Upgrade successful. %Date% at %time%"



goto Complete

) Else (

If "%errorlevel%"=="3010" goto Restart

)

If NOT "%errorlevel%"=="0" goto Failed

:: End Installation



ECHO.



:Complete

Echo ended %time%

Echo Installation Complete!

Exit /B



:Uninstall

ECHO This version of Office 2007 is already installed. Installation of this version cannot continue.

ECHO.

ECHO 1638 Return Code: %computername% - This version of Office 2007 is already installed. %Date% at %time% >> %logfile%



exit /b 1638



:FAILED

echo.

Echo Failed to upgrade to Office 2007. Please restart before running setup again.

ECHO %errorlevel% Return Code: %computername% - Failed to upgrade to Office 2007. Please restart before running setup again. %Date% at %time% >> %logfile%



"%bmail%" -s %SMTPserver% -t %email% -f %FromAddress% -h -a "Office 2007 Installer Results" -b "%errorlevel% Return Code: %computername% - Failed to upgrade to Office 2007. Please restart before running setup again. %Date% at %time%"



exit /b



:Restart

ECHO.

ECHO Microsoft Office 2007 Upgrade successful but COMPUTER NEEDS TO RESTART to complete the install.

ECHO %errorlevel% Return Code: %computername% - Microsoft Office 2007 Upgrade successful but COMPUTER NEEDS TO RESTART to complete the install. %Date% at %time% >> %logfile%



"%bmail%" -s %SMTPserver% -t %email% -f %FromAddress% -h -a "Office 2007 Installer Results" -b "%errorlevel% Return Code: %computername% - Microsoft Office 2007 Upgrade successful but COMPUTER NEEDS TO RESTART to complete the install. %Date% at %time%"



Goto Complete



********** BATCH SCRIPT ENDS **********

Disclaimer

ALL INFORMATION IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SCRIPT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Top

Did you find this batch script useful?

Please feel free to donate for us to continue creating more silent install scripts. Thank you for your support.