Saturday, June 14, 2014

Deploying Office 2013 via Group Policy

Ever since Office 2007 I've wanted to learn how to deploy Microsoft Office by way of Group Policy but never quite grasped how to do it.  Office 2003 worked like all the previous versions by deploying with a simple MSI file which any admin, worth the air he or she breathes, can deploy without much trouble.  Starting with Microsoft Office 2007 the game was changed and deployment via MSI package no longer was an option.  Why they did it I can see now was to facilitate more customization but I just never could get the documentation on how to do it.  The example I will use below is with my experience recently deploying Microsoft Office 2013 Standard but the method is the same whether it be Standard or Pro, 2007, 2010, or 2013.

First copy all of your files from the ISO to a network install folder.  Next using your member server or a workstation execute the setup.exe with an added switch: \\server\share\office15\setup.exe /admin .  From there the Office Customization Tool will start allowing you to do a LOT of customization.  A quick search of the interwebs can show you just what all you can mess with in there but I'll give account of what I cared to mess with.  I added the organization who owned the software, what pieces of the install I wanted, which ones I wanted left out, added my MAK product key (KMS can be used as well), added shortcuts to be left on the user's desktop, etc.  The biggest help I found here.  This helpful admin put the steps out in detail with screen shots on how to get those parts figured out.

1) Run the OCT by typing setup.exe /admin at the command line from the root of the network installation point that contains the Office 2010 source files. For example, use \\server\share\office15\setup.exe /admin.
2) In the OCT, select Licensing and user interface in the left pane, and in the right pane select Enter another product key, add your organization specific MAK Office product key in the Product key field, and other options as desired.
3) In the OCT, select Modify Setup properties in the left pane and then click the Add... button in the right pane.
4) In the Add/Modify Property Value dialog and type AUTO_ACTIVATE in the Name field. Note that property names are case sensitive.
5) In Value field, type 1, and then click OK.
6) Note that the AUTO_ACTIVATE property has been added to the MSP file and has a value of 1.
7) Click the File menu and then click Save as to save the Setup customization file. If the file is saved in the Updates folder that is part of the Office source file location/installation point, running the Office Setup.exe file will automatically detect the customization file in the Updates folder and apply the customizations.
8) As an alternative to placing the customization .msp file in the Updates folder, you can use the Setup command-line option /adminfile to specify the fully qualified path of the location of the MSP file. For example, type setup.exe /adminfile \\server\share\mychanges\custom.msp.

After this is done we need to make some changes to our \\server\share\office15\standard.ww\config.xml file. There is a shell in there allowing you to uncomment-out certain values to install strictly by using the config.xml file I've read but I just left all the default things in there and added my own lines after the last default line and before the </Configuration> tag.
<Display Level="None" CompletionNotice="No" SuppressModal="No" AcceptEula="Yes" />
<AddLanguage Id="match" />
<AddLanguage Id="en-us" ShellTransform="Yes" />
<Setting Id="SETUP_REBOOT" Value="Never" />
<Setting Id="REBOOT" Value="ReallySuppress"/>
<Setting Id="AUTO_ACTIVATE" Value="1" />
<PIDKEY Value="YOURMAKHERE" />

Adding that bit is what will allow the MSP file to continue on installing once it touches the config.xml file.

Last thing to do is configure your startup or shutdown script to kick all of this magic off.  Like I said in the beginning things are not like it used to be.  A cmd script can be used to do all the goodies for you.

The following was borrowed from a technet article but I also made some changes to it only to make it work for my environment. 

setlocal

REM *********************************************************************
REM Environment customization begins here. Modify variables below.
REM *********************************************************************

REM Get ProductName from the Office product's core Setup.xml file, and then add "office14." as a prefix. 
set ProductName=Office15.Standard

REM Set DeployServer to a network-accessible location containing the Office source files.
set DeployServer=\\server\share\office15

REM Set ConfigFile to the configuration file to be used for deployment (required)
set ConfigFile=\\server\share\office15\standard.ww\config.xml

REM Set LogLocation to a central directory to collect log files.
set LogLocation=\\server\share\office15\install-logs

REM *********************************************************************
REM Deployment code begins here. Do not modify anything below this line.
REM *********************************************************************

IF NOT "%ProgramFiles(x86)%"=="" (goto ARP64) else (goto ARP86)

REM Operating system is X64. Check for 32 bit Office in emulated Wow6432 uninstall key
:ARP64
reg query HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432NODE\Microsoft\Windows\CurrentVersion\Uninstall\%ProductName%
if NOT %errorlevel%==1 (goto End)

REM Check for 32 and 64 bit versions of Office 2010 in regular uninstall key.(Office 64bit would also appear here on a 64bit OS) 
:ARP86
reg query HKEY_LOCAL_MACHINE\SOFTWARE\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 /adminfile %DeployServer%\Updates\basic-install.msp
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

That should do it.  Another guy wrote up something similar to this one, http://deployhappiness.com/deploy-office-2013-with-group-policy/, which did help me get started in the right direction but it seems like no one I could find had everything I wanted.  Hope this helps someone else out.

No comments:

Post a Comment