Friday, March 2, 2012

SharePoint 2010 - Powershell Installation Script

Following is a script I used for install 2010 onto farm - really simple - installs SharePoint 2010 , goes thorough initial wizard sets up CA on port 2222, installs basic features and services and then disables loopback.
Before running update the parameters in red




# Execute setup.exe with the setupfarmsilent xml to install SharePoint
#Write-Host "Installing SharePoint 2010 Quietly"
#& ‘C:\install\sp2010i\setup.exe’ ‘/config’ ‘C:\install\config.xml’ | out-null
# Include the SharePoint cmdlets
Write-Host "Loading SharePoint 2010 PowerShell cmdlets"
Add-PsSnapin Microsoft.SharePoint.PowerShell
# Set the farm variables
Write-Host "Setting SharePoint 2010 Farm variables"
$sp_cfdatabasename = "SP2010_Config"
$sp_cadatabasename = "SP2010_Admin_Content"
$sp_databaseserver = "<add databaseserver>"
$sp_passphrase = (ConvertTo-SecureString "<add passphrase>" -AsPlainText -force)
$sp_password = (ConvertTo-SecureString "<add password>" -AsPlainText -force)
$sp_username = "<add username>"


# Clean up the credentials
$sp_credentials = New-Object System.Management.Automation.PsCredential $sp_username,$sp_password
# Execute the config wizard
Write-Host "Add configuration and administration databases"
New-SPConfigurationDatabase -DatabaseName $sp_cfdatabasename -DatabaseServer $sp_databaseserver -AdministrationContentDatabaseName $sp_cadatabasename -Passphrase $sp_passphrase -FarmCredentials $sp_credentials
# Provision a Central Administration Site
Write-Host "Add Central Administration"
New-SPCentralAdministration -Port 2222 -WindowsAuthProvider "NTLM"
# Install all of the help files within Central Admin
Write-Host "Installation of Help files"
Install-SPApplicationContent
# Secure the files and registry entries on the server 
Write-Host "Resource security"
Initialize-SPResourceSecurity
# to install the features on the server. 
Write-Host "Installation of features"
Install-SPFeature -AllExistingFeatures
# to install and and then provision the services onto the farm.
Install-SPService
# Disable the loopback check, run this command from PowerShell.
Write-Host "DisableLoopbackCheck registry key"
New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck"  -value "1" -PropertyType dword
Write-Host "Installation script is complete"

No comments:

Post a Comment