onsdag den 13. februar 2013

Adding December 2012 CU to the Codeplex AutoSPInstaller


After struggling with the slipstreaming problem that Microsoft has introduced after June 2012 CU. I decided to embed this update function to the script itself. This also gives the flexibility to add future updates to the script without using the slipstream functionality.

The function is quit strait forward, just add the unattended install line to a function and call this function after the language pack install. You need to make a folder called "Hotfixes" inside the SharePoint bits folder, and place the update there.

For more information on the AutoSPInstaller from codeplex follow this link.
http://autospinstaller.codeplex.com/   

Here is the function to add

#region Install CU updates
# ===================================================================================
# Func: Install SharePoint CU's
# Desc: Installs the SharePoint collumutive update in unattended mode
# ===================================================================================
function InstallCu()
{
  if(!(test-path -path $SPbits\Hotfixes)){Write-Host "You do not have an hotfix folder"; return}
  $Media = Get-ChildItem $SPbits\Hotfixes | where {$_.Extension -eq ".exe"} | sort-object $_.Name
      
  if($Media -eq $null){write-host "There is now (Cu).exe files in the Hotfix folder"; return }
    foreach($InstallationFile in $Media)
       Write-Host "Installing:" $InstallationFile.Name
       $InstallStart = Get-Date
       try
       {
         . $SPbits\Hotfixes\$InstallationFile /passive /log:$CurrentPath\Logs\$InstallationFile.Name.txt | out-null
       }
       catch
       {
         Throw "- Installation of CU failed"
       }
  }
  Write-host " The installation of CU completed"
}
#endregion

Notes:
More info on using the slipstreaming read this post made by Todd.

Ingen kommentarer:

Send en kommentar