Announcement

Collapse
No announcement yet.

script for deploying office 2007

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • script for deploying office 2007

    Hi All

    i ma having a problem with the script used to deploy office 2007. i ma getting an error with the following line: if %errorlevel%==1 (goto DeployOffice) else (goto End). (Syntax error) can someone help?

    Thanks
    Gregory


    Here is the entire script
    Code:
    setlocal
    
    REM *********************************************************************
    REM Environment customization begins here. Modify variables below.
    REM *********************************************************************
    
    REM Get ProductName from the Office product's core Setup.xml file.
    set ProductName=Enterprise
    
    REM Set DeployServer to a network-accessible location containing the Office source files.
    set DeployServer=\\server\share\Office12
    
    REM Set ConfigFile to the configuration file to be used for deployment REM (required)
    set ConfigFile=\\server\share\Office12\Enterprise.WW\config.xml
    
    REM Set LogLocation to a central directory to collect log files.
    set LogLocation=\\server\share\Office12Logs
    
    REM *********************************************************************
    REM Deployment code begins here. Do not modify anything below this line.
    REM *********************************************************************
    
    IF NOT "%ProgramFiles(x86)%"=="" SET WOW6432NODE=WOW6432NODE\
    
    reg query HKEY_LOCAL_MACHINE\SOFTWARE\%WOW6432NODE%Microsoft\Windows\CurrentVersion\Uninstall\%ProductName%
    if %errorlevel%==1 (goto DeployOffice) else (goto End)
    
    REM If 1 returned, the product was not found. Run setup here.
    :DeployOffice
    start /wait %DeployServer%\setup.exe /config %ConfigFile%
    echo %date% %time% Setup ended with error code %errorlevel%. >> %LogLocation%\%computername%.txt
    
    REM If 0 or other was returned, the product was found or another error occurred. Do nothing.
    :End
    
    Endlocal
    Last edited by Dumber; 4th November 2009, 14:31. Reason: wrapped code tags around the script.

  • #2
    Re: script for deploying office 2007

    See for examples over here: http://www.robvanderwoude.com/errorlevel.php

    Anyway change it to this; it should work:
    Code:
    IF %errorlevel%==1 GOTO DeployOffice
    GOTO End
    But why not using GPO's?
    Marcel
    Technical Consultant
    Netherlands
    http://www.phetios.com
    http://blog.nessus.nl

    MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
    "No matter how secure, there is always the human factor."

    "Enjoy life today, tomorrow may never come."
    "If you're going through hell, keep going. ~Winston Churchill"

    Comment


    • #3
      Re: script for deploying office 2007

      Originally posted by ron_zac007 View Post
      i ma getting an error with the following line: if %errorlevel%==1 (goto DeployOffice) else (goto End). (Syntax error)
      There is no syntax error in the line you showed.
      The sample you showed here is directly copied from http://technet.microsoft.com/en-us/l.../cc179134.aspx.
      So the problem apparently is in your version of the script?, check spelling and punctuation.


      Here is the same sample with some minor changes. Adjust the blue colored variable values accordingly.
      Code:
      :: You should run this batch as computer startup script (!)
      
      @echo off
      
      setlocal
      
      REM *********************************************************************
      REM Environment customization begins here. Modify variables below.
      REM *********************************************************************
      
      REM Get ProductName from the Office product's core Setup.xml file.
      set "ProductName=Enterprise"
      
      REM Set DeployServer to a network-accessible location containing the Office source files.
      set "DeployServer=\\server\share\Office12"
      
      REM Set ConfigFile to the configuration file to be used for deployment REM (required)
      set "ConfigFile=\\server\share\Office12\Enterprise.WW\config.xml"
      
      REM Set LogLocation to a central directory to collect log files.
      set "LogLocation=\\server\share\Office12Logs"
      
      REM *********************************************************************
      REM Deployment code begins here. Do not modify anything below this line.
      REM *********************************************************************
      
      IF NOT "%ProgramFiles(x86)%"=="" SET "WOW6432NODE=WOW6432NODE\"
      Set "regKey=HKEY_LOCAL_MACHINE\SOFTWARE\%WOW6432NODE%Microsoft"
      Set "regKey=%regKey%\Windows\CurrentVersion\Uninstall\%ProductName%"
      
      2> nul Reg.exe QUERY "%regKey%" &&(goto:End)
      
      REM The product was not found. Run setup here.
      :DeployOffice
      echo Deploy Office now
      start ""/w "%DeployServer%\setup.exe" /config "%ConfigFile%"
      >> "%LogLocation%\%computername%.txt" echo %date% %time% Setup ended with error code %errorlevel%.
      
      Endlocal & Goto:eof
      
      :End
      echo The product was found or another error occurred. Do nothing.
      Endlocal

      This posting is provided "AS IS" with no warranties, and confers no rights.

      __________________

      ** Remember to give credit where credit's due **
      and leave Reputation Points for meaningful posts

      Comment


      • #4
        Re: script for deploying office 2007

        Ah I didn't know that syntax would work
        Marcel
        Technical Consultant
        Netherlands
        http://www.phetios.com
        http://blog.nessus.nl

        MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
        "No matter how secure, there is always the human factor."

        "Enjoy life today, tomorrow may never come."
        "If you're going through hell, keep going. ~Winston Churchill"

        Comment

        Working...
        X