Office Web App unattended installation mode

Nov 4, 2010 at 7:39 PM
Edited Nov 4, 2010 at 7:40 PM

Hi,

A suggestion: add Office Web App unattended install to the global script

For now, I use the following scripts:

Start-Process "$OWA2010SetupPath\setup.exe" -ArgumentList "/config `"$OWA2010ConfigXmlPath`"" -WindowStyle Minimized -Wait

for the config, I use the one provided in ISO setup modified like this:

<Configuration>
 <Package Id="sts">
  <Setting Id="LAUNCHEDFROMSETUPSTS" Value="Yes"/>
 </Package>

 <Logging Type="verbose" Path="%temp%" Template="Wac Server Setup(*).log"/>
  <Display Level="none" CompletionNotice="no" AcceptEula="no" SuppressModal="yes" NoCancel="yes"/>
 <PIDKEY Value="xxx-xxx-xxxx..."/>
 <Setting Id="SERVERROLE" Value="APPLICATION"/>
 <Setting Id="USINGUIINSTALLMODE" Value="0"/>
 <Setting Id="SETUPTYPE" Value="CLEAN_INSTALL"/>
 <Setting Id="SETUP_REBOOT" Value="Never"/>
</Configuration>

Pierre Vivier-Merle
http://blogs.developpeur.org/pierre

Nov 14, 2010 at 3:06 PM

I got this working. Place the Office Web Apps installation files in a OfficeWebApps folder same level as Scripted. On top of that I also modified the CreateCentralAdministration function to just run the install features if there is no central admin installed so that Office Web Apps gets registered with the config db. Place a new config file as the posting above that is stored in the variable $OWAConfigFile. Once this is done all the office web apps service applications can be created.

Add a New Parameter to the script to let user choose whether to install or not install office web apps

#Region Install OfficeWebApps
Function InstallOfficeWebApps
{
 If  (Test-Path "$env:CommonProgramFiles\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\OfficeWebApps\feature.xml") #Crude way of checking if Office Web Apps is already installed
 {
  Write-Host -ForegroundColor White "- Office Web Apps binaries appear be already installed - skipping installation."
 }
 Else
 {
  ## Install Office Web Apps Binaries
  If (Test-Path "$bits\OfficeWebApps\setup.exe")
  {
     Write-Progress -Activity "Installing OfficeWebApps (Unattended)" -Status "Installing OfficeWebApps binaries..."
   Write-Host -ForegroundColor White "- Installing OfficeWebApps binaries..."
     try
   {
    Start-Process "$bits\OfficeWebApps\setup.exe" -ArgumentList "/config `"$dp0\$OWAConfigFile`"" -WindowStyle Minimized -Wait
    If (-not $?) {throw}
   }
   catch
   {
    Write-Warning "- Error $LastExitCode occurred running $bitslocation\OfficeWebApps\setup.exe"
    break
   }
   ## Parsing most recent Office Web Apps Setup log for errors or restart requirements, since $LastExitCode doesn't seem to work...
   $SetupLog = get-childitem $env:TEMP | ? {$_.Name -like "Wac Server Setup*"} | Sort-Object -Descending -Property "LastWriteTime" | Select-Object -first 1
   If ($SetupLog -eq $null)
   {
    Write-Warning " - Could not find Office Web Apps Setup log file!"
    Pause
    break
   }
   Else
   {
    ## Get error(s) from log
    $SetupLastError = $SetupLog | select-string -SimpleMatch -Pattern "Error:" | Select-Object -Last 1 #| ? {$_.Line  -notlike "*Startup task*"}
    If ($SetupLastError)
    {
     Write-Warning $SetupLastError.Line
     #$SetupLastReturncode = $SetupLog | select-string -SimpleMatch -Pattern "Last return code" | Select-Object -Last 1
     #If ($SetupLastReturnCode) {Write-Warning $SetupLastReturncode.Line}
     Write-Host -ForegroundColor White " - Review the log file and try to correct any error conditions."
     Pause
     Invoke-Item $env:TEMP\$SetupLog
     break
    }
    ## Look for restart requirement in log
    $SetupRestartNotNeeded = $SetupLog | select-string -SimpleMatch -Pattern "System reboot is not pending."
    If (!($SetupRestartNotNeeded))
    {
     Write-Host -ForegroundColor White " - SharePoint setup requires a restart."
     Write-Host -ForegroundColor White " - Run the script again after restarting to continue."
     Pause
     break
    }
   }

   Write-Host -ForegroundColor Blue "- Waiting for SharePoint Products and Technologies Wizard to launch..." -NoNewline
   While ((Get-Process |?{$_.ProcessName -like "psconfigui*"}) -eq $null)
   {
    Write-Host -ForegroundColor Blue "." -NoNewline
    sleep 1
   }
   Write-Host -ForegroundColor Blue "Done."
     Write-Host -ForegroundColor White "- Exiting Products and Technologies Wizard - using Powershell instead!"
   Stop-Process -Name psconfigui
  }
  Else
  {
     Write-Host -ForegroundColor Red "- Install path $bitslocation\OfficeWebApps Not found!!"
     Pause
   break
  }
 }
 
}
If ($InstallOfficeWebApps -eq "1") {InstallOfficeWebApps}
#EndRegion

#Region Create Central Admin
Function CreateCentralAdmin
{

## As Per Script abbreviated...
}
Function InstallServicesFeatures
{
 Write-Host -ForegroundColor White "- InstallingServicesandFeatures..."
 try
 {
  ## Install Help Files
  Write-Host -ForegroundColor White " - Installing Help Collection..."
  Install-SPHelpCollection -All
  ## Secure resources
  Write-Host -ForegroundColor White " - Securing Resources..."
  Initialize-SPResourceSecurity
  ## Install Services
  Write-Host -ForegroundColor White " - Installing Services..."
  Install-SPService
  ## Install (all) features
  Write-Host -ForegroundColor White " - Installing Features..."
  $Features = Install-SPFeature –AllExistingFeatures -Force
  Write-Host -ForegroundColor White " - Installing Application Content..."
  Install-SPApplicationContent
 }
 catch 
 {
      If ($err -like "*update conflict*")
  {
   Write-Warning " - A concurrency error occured, trying again."
   InstallServicesFeatures
  }
  Else
  {
   Write-Output $_
   Pause
   break
  }
 }
 Write-Host -ForegroundColor White "- Done Installing Services and Features."
}
If ($CreateCentralAdmin -eq "1") {CreateCentralAdmin}
Else {InstallServicesFeatures} 


Nov 14, 2010 at 3:29 PM

Great!

Thank you Cygoh!

Question: do you need to laund the SharePoint configuration after that?

Brian, you may add this on spAutoInstaller ?

Best regards,

Pierre Vivier-Merle
http://blogs.developpeur.org/pierre 

Nov 15, 2010 at 3:54 AM

Hi Pierre,

  As far as I saw, you did't need do. The second part of the function (Installs Service Features) in the case  which installs all the services and features is as good as running the SharePoint Configuration itself

Coordinator
Nov 24, 2010 at 2:49 PM

Great work guys. I am definitely planning on incorporating this as suggested, soon the script will be refactored so that adding functions like this should be much easier.

Brian

Developer
Jan 4, 2011 at 8:36 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.