0% found this document useful (0 votes)
188 views7 pages

SharePoint 2010 Installation Script

This script installs SharePoint 2010 on Windows 7 by completing the following steps: 1. Adds required Windows components 2. Downloads prerequisite installers from Microsoft 3. Installs the prerequisites 4. Creates an XML configuration file for a single-server SharePoint installation 5. Installs SharePoint 2010

Uploaded by

Jason Mendoza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
188 views7 pages

SharePoint 2010 Installation Script

This script installs SharePoint 2010 on Windows 7 by completing the following steps: 1. Adds required Windows components 2. Downloads prerequisite installers from Microsoft 3. Installs the prerequisites 4. Creates an XML configuration file for a single-server SharePoint installation 5. Installs SharePoint 2010

Uploaded by

Jason Mendoza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

#*************************************************************************************

***************
#This script installs SharePoint 2010 on Windows 7, Do not run this script to install
SharePoint 2010
#on Windows Server 2008 or Windows 2008 R2 or any other Operating Systems.
#
# This script will prompt to enter SetUp Dir path and SharePoint Server 2010 Product K
ey to be used when
# Installing
#
# Step 1 Add/Remove windows Components
# Step 2 Downloads Pre-Reqs from Microsoft Downloads site
# Step 3 Install Pre-Reqs
# Step 4 Creates a [Link] file for Windows Client Install (SingleServer mode)
# Step 5 Install SharePoint 2010
#*************************************************************************************
******************
param([string]$SetupDir = $(Read-Host -
Prompt "Please Enter Directory Path where SharePoint 2010 [Link] is")
,[string]$PidKey = $(Read-Host -
Prompt "Enter SharePoint Server 2010 Product Key"))

Import-Module BitsTransfer

$DownloadUrls = (

"[Link]
BD5D-
F95BB254EC61/Redist/amd64/Microsoft%20Sync%20Framework/[Link]", # http://
[Link]/fwlink/?LinkID=141237&clcid=0x409 -
Microsoft Sync Framework Runtime v1.0 (x64)
"[Link]
a5b3-
f10529178b8a/[Link]", # "[Link]
9" - SQL Server 2008 Native Client
"[Link]
875B-C2B40A6B2BDD/Windows6.1-KB974405-
[Link]", # "[Link] -
Windows Identity Framework (Win2008 R2)
"[Link]
867E-
6799E99AB93F/ADONETDataServices_v15_CTP2_RuntimeOnly.exe", # "[Link]
fwlink/?LinkId=158354" - [Link] Data Services v1.5 CTP2 (Win2008 SP2)
"[Link]
a8e0-62a8510aa747/[Link]", # "[Link] -
Microsoft Chart Controls for the Microsoft .NET Framework 3.5
"[Link]
88a1-
9c4321d90677/SQLSERVER2008_ASADOMD10.msi" # "[Link]
0651&clcid=0x409" -
Microsoft SQL Server 2008 Analysis Services [Link]
)


function AddRemoveWindowsComponents()
{
Write-Host "Enabling required windows components"

$ReturnCode = 0
$WindowsFeatures = (
"IIS-WebServerRole",
"IIS-WebServer",
"IIS-CommonHttpFeatures",
"IIS-StaticContent",
"IIS-DefaultDocument",
"IIS-DirectoryBrowsing",
"IIS-HttpErrors",
"IIS-ApplicationDevelopment",
"IIS-ASPNET",
"IIS-NetFxExtensibility",
"IIS-ISAPIExtensions",
"IIS-ISAPIFilter",
"IIS-HealthAndDiagnostics",
"IIS-HttpLogging",
"IIS-LoggingLibraries",
"IIS-RequestMonitor",
"IIS-HttpTracing",
"IIS-CustomLogging",
"IIS-ManagementScriptingTools",
"IIS-Security",
"IIS-BasicAuthentication",
"IIS-WindowsAuthentication",
"IIS-DigestAuthentication",
"IIS-RequestFiltering",
"IIS-Performance",
"IIS-HttpCompressionStatic",
"IIS-HttpCompressionDynamic",
"IIS-WebServerManagementTools",
"IIS-ManagementConsole",
"IIS-IIS6ManagementCompatibility",
"IIS-Metabase",
"IIS-WMICompatibility",
"WAS-WindowsActivationService",
"WAS-ProcessModel",
"WAS-NetFxEnvironment",
"WAS-ConfigurationAPI",
"WCF-HTTP-Activation",
"WCF-NonHTTP-Activation"
)
Try
{
$StartInfo = New-Object -TypeName [Link]
$[Link] = "$Env:windir\System32\[Link]"
$[Link] = [[Link]]::Minimized
$WindowsfeaturesString = [string]::join(";", $WindowsFeatures)
$pArgs = "/iu:$WindowsfeaturesString /quiet"
Write-Host $pArgs
$[Link] = $pArgs
$StartTime = [[Link]]::Now
$Step = 5
$Val = 0
$InstallProcess = [[Link]]::Start($StartInfo)

While( -not($[Link]))
{
$CurrentRuntime = [[Link]]::Now - $StartTime
Write-Progress -Activity "Add/Remove Windows Components..." -
PercentComplete ($Val+=$Step) -
Status ("Add/Remove windows components has been running for {0}:{1}:{2}" -
f $[Link]("00"), $[Link]("00"), $Curre
[Link]("00"))

if ($Val -ge 100) { $Val = 0}
Start-Sleep -Seconds 1
}
Write-Host "Done enabling all required windows components"
}
Catch
{
$ReturnCode = -1
Write-Warning "Error Add/Remove Windows Components"
Write-Error $_
Break;
}

return $ReturnCode
}

function DownLoadPreRequisites()
{
$ReturnCode = 0
Write-Host "Downloading Pre-
Reqs required for SharePoint 2010 Windows Client Install"

#download sharepoint 2010 prerequisites
$PreReqInstallerDir = "$SetupDir\PrerequisiteInstallerFiles"

ForEach ($DownLoadUrl in $DownloadUrls)
{
## Get the file name based on the portion of the URL after the last slash
$FileName = $[Link]('/')[-1]
Try
{
## Check if destination file already exists
If (!(Test-Path "$PreReqInstallerDir\$FileName"))
{
## Begin download
Start-BitsTransfer -Source $DownLoadUrl -
Destination $PreReqInstallerDir\$fileName -
DisplayName "Downloading `'$FileName`' to $PreReqInstallerDir" -Priority High -
Description "From $DownLoadUrl..." -ErrorVariable err
If ($err) {Throw ""}
}
Else
{
Write-Host " - File $FileName already exists, skipping..."
}
}
Catch
{
$ReturnCode = -1
Write-Warning " - An error occurred downloading `'$FileName`'"
Write-Error $_
break
}
}
Write-Host "Done downloading Pre-
Reqs required for SharePoint 2010 windows client install"

return $ReturnCode
}

function InstallPreReqs()
{
Write-Host "Installing Pre-
Reqs required for SharePoint 2010 windows client install"
$PreReqInstallerDir = "$SetupDir\PrerequisiteInstallerFiles"

#install filter pak
$Filterpak = "$PreReqInstallerDir\FilterPack\[Link]"
If (Test-Path -Path $Filterpak)
{
Try
{
Write-Host "Installing FilterPack"
$StartInfo = New-Object -TypeName [Link]
$[Link] = $filterpak
$[Link] = [[Link]]::Minimize
d
$InstallProcess = [[Link]]::Start($StartInfo);

While(-not($[Link]))
{
Start-Sleep -Seconds 1
}
Write-Host "FilterPack installed successfully"
}
Catch
{
$ReturnCode = -1
Write-Warning " - An error occurred while installing FilterPak"
Write-Error $_
break
}
}
else
{
Write-Host "FilterPack install bits not found, exiting..."
break;
}

#Install rest of the Pre-Reqs that was downloaded for Windows Client Install
ForEach ($DownLoadUrl in $DownloadUrls)
{
## Get the file name based on the portion of the URL after the last slash
$FileName = $[Link]('/')[-1]
Try
{
## Check if destination file already exists
If (Test-Path "$PreReqInstallerDir\$FileName")
{
$StartInfo = New-Object -
TypeName [Link]
$[Link] = "$PreReqInstallerDir\$FileName"
$[Link] = [[Link]]::Mini
mized
$InstallProcesss = [[Link]]::Start($StartInfo);

While(-not($[Link]))
{
Start-Sleep -Seconds 1
}
Write-Host "$FileName installed successfully"
}
}
Catch
{
$ReturnCode = -1
Write-Warning " - An error occurred while installing`'$FileName`'"
Write-Error $_
break
}
}
return $ReturnCode
}

function InstallSharePoint2010()
{
$rc = 0
#Add Remove Windows Components
$rc = AddRemoveWindowsComponents

#Download Pre-Reqs for Windows Client Install
if($rc -ne -1)
{
$rc = DownLoadPreRequisites
}

#Install the Pre-Reqs
if($rc -ne -1)
{
$rc = InstallPreReqs
}

Try
{
#SetUp Config File for Installing SharePoint 2010 in Silent Mode on Windows Cl
ient
[[Link]]$XmlDoc =
@"
<Configuration>
<Logging Type="verbose" Path="%temp%" Template="SharePoint Server Setup(*)
.log"/>
<Display Level="none" CompletionNotice="no" AcceptEula="no" SuppressModal=
"yes" NoCancel="yes"/>
<PIDKEY Value="Enter PID Key Here" />
<Setting Id="SERVERROLE" Value="SINGLESERVER"/>
<Setting Id="USINGUIINSTALLMODE" Value="0"/>
<Setting Id="SETUP_REBOOT" Value="Never" />
<Setting Id="SETUPTYPE" Value="CLEAN_INSTALL"/>
</Configuration>
"@

#Set the SharePoint 2010 Product Key
Write-Host "Setting PIDKey in Config File"
$[Link] = $PidKey

#update the config file to allow windows client install. <Setting Id="AllowWin
dowsClientInstall" Value="True"/>
Write-Host "Setting AllowWindowsClientInstall in Config File"
$ClientOSNode = $[Link]([[Link]]::Element, "Setting
", $null);
$[Link]("Id", "AllowWindowsClientInstall")
$[Link]("Value", "True")
$[Link]($ClientOSNode) | Out-Null

$ConfigXmlDir = "$SetupDir\Files\SetupSilent\"
$ConfigXmlName = ("config_{0}.xml" -f (Get-Date -
Format 'yyyy_MMM_dd_HH_mm_ss') )
$ConfigXmlPath = Join-Path $ConfigXmlDir $ConfigXmlName

Write-Host "Saving [Link] file to $ConfigXmlPath"
$[Link]($ConfigXmlPath)

#Install SharePoint 2010
Write-Host "Installing SharePoint 2010"
$SetupArgs = ("/config {0}" -f $ConfigXmlPath)
Write-Host "Setup Arguments :$SetupArgs"
$SetupExePath = Join-Path $SetupDir "[Link]"
Write-Host "Running Command : $SetupExePath"

$StartTime = [[Link]]::Now
$Step = 5
$Val = 0

$SetupExe = [[Link]]::Start($SetupExePath, $SetupArgs)
While(-not($[Link]))
{
$CurrentRuntime = [[Link]]::Now - $StartTime
Write-Progress -Activity "Installing SharePoint..." -
PercentComplete ($Val+=$Step) -Status ("Setup has been running for {0}:{1}:{2}" -
f $[Link]("00"), $[Link]("00"), $Curre
[Link]("00"))

if ($Val -ge 100) { $Val = 0}
Start-Sleep -Seconds 5
}

Write-
Host "SharePoint 2010 Install Complete, Please remember to run the Farm Configuration
wizard"
}
Catch
{
Write-Warning "Error - Installing SharePoint 2010"
Write-Error $_
Break;
}
}

InstallSharePoint2010

You might also like