Saturday, 16 February 2013

Powershell script to Download SharePoint 2013 Pre-Requisites

When you need to install SharePoint offline (when you don’t have internet access in SharePoint server) ,  you should download all of the software prerequisites, All of these prerequisites needed for a successful installation are listed in this blog post: http://blogs.technet.com/b/meamcs/archive/2012/12/26/install-and-download-sharepoint-2013-prerequisites-offline-manually.aspx

Or you can download the following Powershell script and run it on your machine to download these software prerequisites.

Download "Script to Download SharePoint 2013 Pre-Requisites" powershell file: http://gallery.technet.microsoft.com/office/Script-to-SharePoint-2013-702e07df

Script:
# This commands script file creates a new BITS transfer job that downloads all Sharepoint 2013 Prerequisites files
# Author: Muawiyah Shannak (@MuShannak)
# Blog: http://mushannak.blogspot.com/
# Last Update : 2/11/2013
# Source: http://gallery.technet.microsoft.com/Script-to-SharePoint-2013-702e07df

$DestinationFolder = Read-Host -Prompt "Please enter the destination path for Sharepoint 2013 Prerequisites files"

# Note: The Prerequisite Files URLs are subject to change at Microsoft's discretion - check http://technet.microsoft.com/en-us/library/cc262485(v=office.15).aspx and update the links.
$FilesUrlList = ("http://download.microsoft.com/download/D/0/F/D0F564A3-6734-470B-9772-AC38B3B6D8C2/dotNetFx45_Full_x86_x64.exe"# Microsoft .NET Framework version 4.5
             "http://download.microsoft.com/download/9/1/3/9138773A-505D-43E2-AC08-9A77E1E0490B/1033/x64/sqlncli.msi"# SQL Server 2008 R2 SP1 Native Client
             "http://download.microsoft.com/download/8/F/9/8F93DBBD-896B-4760-AC81-646F61363A6D/WcfDataServices.exe"# Microsoft WCF Data Services 5.0
             "http://download.microsoft.com/download/9/1/D/91DA8796-BE1D-46AF-8489-663AB7811517/setup_msipc_x64.msi"# Microsoft Information Protection and Control Client (MSIPC)
             "http://download.microsoft.com/download/E/0/0/E0060D8F-2354-4871-9596-DC78538799CC/Synchronization.msi"# Microsoft Sync Framework Runtime v1.0 SP1 (x64) 
             "http://download.microsoft.com/download/5/2/B/52B59966-3009-4F39-A99E-3732717BBE2A/Windows6.1-KB2506143-x64.msu"# Windows Management Framework 3.0 which includes Windows PowerShell 3.0
             "http://download.microsoft.com/download/0/1/D/01D06854-CA0C-46F1-ADBA-EBF86010DCC6/r2/MicrosoftIdentityExtensions-64.msi"# Windows Identity Extensions
             "http://download.microsoft.com/download/D/7/2/D72FD747-69B6-40B7-875B-C2B40A6B2BDD/Windows6.1-KB974405-x64.msu"# Windows Identity Foundation (KB974405)
             "http://download.microsoft.com/download/A/6/7/A678AB47-496B-4907-B3D4-0A2D280A13C0/WindowsServerAppFabricSetup_x64.exe"#Windows Server AppFabric
             "http://download.microsoft.com/download/7/B/5/7B51D8D1-20FD-4BF0-87C7-4714F5A1C313/AppFabric1.1-RTM-KB2671763-x64-ENU.exe" # CU 1 for AppFabric 1.1 (KB2671763)
             )

function CreateDestinationFolder()
{
    Try
    {
        ## Return true if the Destination Folder exists, otherwise return false
        If (!(Test-Path "$DestinationFolder" -pathType container))
        {
            ##Creates the destination folder if it does not exist
            New-Item $DestinationFolder -ItemType Directory
        }
    }
    Catch
    {
        Write-Host "An error occurred creating destination folder (`'$DestinationFolder`'), Please check the path,and try again."
        Pause
        break
    }
}

function DownloadSP2013Files()
{
    Import-Module BitsTransfer
    Write-Host "BitsTransfer Module is loaded"
    Write-Host "Downloading..."

    ForEach ($FileUrl in $FilesUrlList)
    {
        ## Get the file name
        $DestinationFileName = $FileUrl.Split('/')[-1]
   
        Try
        {
           
            ## Return true if the file exists, otherwise return false
            If (!(Test-Path "$DestinationFolder\$DestinationFileName"))
            {
                Write-Host "`'$FileUrl`' ..."
                Start-BitsTransfer -Source $FileUrl -Destination $DestinationFolder\$DestinationFileName -Priority High -ErrorVariable err
                If ($err) {Throw ""}
            }
            Else
            {
                Write-Host "File $DestinationFileName already exists, skipping..."
            }
        }
        Catch
        {
            Write-Warning "An error occurred downloading `'$DestinationFileName`'"
            break
        }
    }
}

function Pause($Message="Press any key to continue...")
{
    Write-Host -NoNewLine $Message
    $null = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
    Write-Host ""
}

CreateDestinationFolder
DownloadSP2013Files
Pause
 ###################################

1 comment:

  1. Great post...does anybody know what are space requirements of above SharePoint 2013 Pre-Requisites. Thanks. Please post also on my email amjpk@yahoo.com.

    ReplyDelete