Office 2007 Deployment: The Main Script Part 4

And so now we come to what some people would describe as the interesting part of our rollout; the customised Office Ribbon we created which links to help files stored. Now the best part of all this is that we have to ensure that .net frameworks 3.5 SP1 is installed on the users workstations before we even attempt to install the Visual Studio Runtime files (which we need to install in order to use VSTOInstaller.exe to siliently install the ribbon files)

Here is the code we will use to achieve this:

;*********** Install .Net Frameworks 3.5 SP1 ******************
;added section to install .Net frameworks 3.5sp1 due to requirement by VSTOinstaller.exe

$sp1value = “Blank”
$sp1value = ReadValue(“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5″,”Version”)
if ($sp1value <> “3.5.30729.01” and $officeinstall <> “0”)
 ? “Installing .net framework 3.5 SP1”
 Shell “
\\server\netlogon\net2\dotnetfx35.exe /qb /norestart”
 if @error = 0
 ? “.net frameworks 3.5 SP1 installed”
 $netpresent = “1”
 ?”.net frameworks install failed, please check”

$sp1value = ReadValue(“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5″,”Version”) is the part where we read a certain area of the registry to determine the current version of .net frameworks installed on the users machines, with the $sp1value variable gaining the value of the key the script has just read. The if ($sp1value <> “3.5.30729.01” and $officeinstall <> “0”) part is another condition where the value of the variable should be 3.5.30729.01. if not, then we assume .net frameworks 3.5 sp1 is not present.

How did we know this value is right? Well, it’s handy when it’s written down!

Shell \\server\netlogon\net2\dotnetfx35.exe /qb /norestart” points to running the .net installation in a reduced state which means all the users should see is a progress bar telling them how far along the installation is for that particular product, and they should have to answer any questions.

We once again populate a variable ($netpresent) to account for a successful install. 

;************ Install Visual Studio Runtime for Office 2007 ******************
; Will install Visual Studio only if .net frameworks 3.5 SP1 is installed

$netvalue = ReadValue(“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5″,”Install”)
if @error = 0
  if ($netvalue = “1” and $officeinstall <> “0” And Not Exist (“C:\Windows\OfficeTrack\VSTO.txt”))
  ? “Installing Visual Studio Tools 3.0”
  Shell “
\\server\office2007$\VSTO\vstor30.exe /q”
  if @error = 0
   Copy “
\\server\office2007$\VSTO\VSTO.txt” “C:\Windows\Officetrack”
   ? “Setup of Visual Studio Runtime complete”
   $VSTOPresent = “1”
  ? “There has been an issue with the Visual Studio Runtime Install.”
? “Error reading registry key for .Net Frameworks 3.5 Check”
? “Visual Studio Tools 3.0 install bypassed”

For the Visual studio runtime tools we check for the presence of .net frameworks first before allowing the install to take place (via the /q switch) and again it uses the same convention as we have used before.

So now we’ve come to the point where we install the help files themselves:

;************* Copy and install Office 2007 “Ribbon” files and training videos to all machines *************
;The Files are copied to the Windows Directory as it is likely no-one will bother looking in that
;directory to delete things

If ($officeinstall <> “0” And Not Exist (“C:\WINDOWS\Ribbon”))
 MD C:\Windows\Ribbon
 if @error = 0
 ? “Ribbon Folder Created”
? “Ribbon folder creation bypassed”

If $officeinstall <> “0” And Not Exist (“C:\Windows\OfficeTrack\RibbonCopied.txt”)
 Shell ‘xcopy “
\\server\netlogon\Ribbon\*.*” “C:\Windows\Ribbon” /E /Y /Q’
 if @error = 0
  Copy “
\\server\netlogon\OfficeRibbonInstall\RibbonCopied.txt” “C:\Windows\OfficeTrack”
  ? “Help file copy bypassed or failed”

If exist (“C:\Windows\OfficeTrack\RibbonCopied.txt”)
 $ribbonpresent = “1”
 $ribbonpresent = “0”

Basically this whole part creates a folder called “C:\Windows\Ribbon” and then copies files from a network location to the local workstation. You do have the choice of whether or not to do this, as you could just keep the files in a network location but whatever location you choose, it would have to be reflected in the Ribbon files created within Visual Studio 2008.

We used the xcopy command rather than KIX’s own copy function just to ensure for our own piece of mind that all files actually copied across.

I know that using the Windows Directory to store things is a no-no in general circles but as the users here have full access to their workstations, it was just a matter of choosing somewhere to “hide” the files so no-one just deletes things. Granted we could look at the Program Files folder but I guess I didn’t want to handle spaces!

Now next time we’ll install the ribbons sliently via the KIX script. Or will there be something which stops that (given that question, the answer is yes, but why spoil the fun now….) ?