ACS Blogs

A blog site for Architecting Connected Systems staff to tell the world about their exploits in
SharePoint 2007/2010, Windows Workflow Foundation (3.0/4.0) and other great technologies!
Welcome to ACS Blogs Sign in | Join | Help
in Search

CJG

Scripting Sharepoint 2010, Zero to C (as in E=MC^2)

So you wanna script your entire SharePoint 2010 Farm install eh?  Want me to show you how to do it?  I'm sure you do!  Here's the steps:

set share=”//servername/PreReqs”

prerequisiteinstaller /unattended /SQLNCli:%share%/sqlncli.msi /ChartControl:%share%/MSChart.exe /IDFXR2:%share%/MicrosoftGenevaFramework.amd64.msi /Sync:%share%/Synchronization.msi /filterpack:%share%/filterpack.msi /ADOMD:%share%/SQLSERVER2008_ASADOMD10.msi

  • Create a config.xml file

<Configuration>
<Package Id="sts">
<Setting Id="LAUNCHEDFROMSETUPSTS" Value="Yes"/>
</Package>
<Package Id="spswfe">
<Setting Id="SETUPCALLED" Value="1"/>
<Setting Id="OFFICESERVERPREMIUM" Value="1" />
</Package>
<Logging Type="verbose" Path="%temp%" Template="SharePoint Server Setup(*).log"/>
<PIDKEY Value="{YOURKEY}" />
<Display Level="none" CompletionNotice="yes" />
<Setting Id="SERVERROLE" Value="APPLICATION"/>
<Setting Id="USINGUIINSTALLMODE" Value="0"/>
<Setting Id="SETUPTYPE" Value="CLEAN_INSTALL"/>
<Setting Id="SETUP_REBOOT" Value="Never"/>

</Configuration>

  • Run the following command pointing to your config.xml file to install sharepoint

setup /config <pathto>config.xml

  • Configure SharePoint 2010

set s="C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\BIN\stsadm.exe"
set ps="c:\program files\common files\microsoft shared\web server extensions\14\bin\psconfig.exe"
set farmadmin=CONTOSO\SP_Farm
set sql=DBNAME
set p=Pa$$w0rd

%ps% -cmd configdb -create -server %sql% -database SharePoint_Config -user %farmadmin% -password %p% -passphrase %p% -admincontentdatabase SharePoint_AdminContent
%ps% -cmd adminvs -provision -port 9999 -windowsauthprovider onlyusentlm
%ps% -cmd services install
%ps% -cmd secureresources
%ps% -cmd installfeatures

  • Start all Services

Get-SPServiceInstance | foreach-object {Start-SPServiceInstance -identity $_.Id }

  • Create ALL the service applications

$DbServerAddress = "DBNAME"

$farmPassPhrase = ’Pa$$w0rd’

$svcPwd = ’Pa$$w0rd’

$username = "CONTOSO\SP_Service"

$password = ConvertTo-SecureString $svcPwd -asplaintext -force

$credential = New-Object System.Management.Automation.PSCredential $Username, $Password

$managedAccount = new-SPManagedAccount -credential $credential

$app = New-SPIisWebServiceApplicationPool "All Services" -account $managedAccount

#New-SPUsageApplication -name "Usage and Health Service Application"

New-SPAccessServiceapplication -applicationpool $app -name "Access Services"

New-SPBusinessDataCatalogserviceapplication -applicationpool $app -name "Business Connectivity Service Services"

New-SPExcelServiceApplication -applicationpool $app -name "Excel Services Application"

$md = New-SPMetadataServiceApplication -applicationpool $app -name "Managed Metadata Service"

New-SPMetadataServiceApplicationProxy -name "Managed Metadata Service" -serviceapplication $md

$pps = New-SPPerformancePointServiceApplication -applicationpool $app -name "PerformancePoint Service"

New-SPPerformancePointServiceApplicationProxy -name "PerformancePoint Service" -serviceapplication $pps

New-SPStateServiceApplication -name "State Service"

$ps = New-SPProfileServiceApplication -applicationpool $app -name "User Profile Service"

New-SPProfileServiceApplicationProxy -name "User Profile Service" -serviceapplication $ps

$vgs = New-SPVisioServiceApplication -applicationpool $app -name "Visio Graphics Service"

New-SPVisioServiceApplicationProxy -serviceapplication $vgs -name "Visio Graphics Service"

$was = New-SPWebAnalyticsServiceApplication -applicationpool $app -name "Web Analytics Service Application"

New-SPWebAnalyticsServiceApplicationProxy -serviceapplication $was -name "Web Analytics Service Application"

New-SPWordConversionServiceApplication -applicationpool $app -name "Word Service"

$serviceapp = New-SPSecureStoreServiceApplication -Name "Secure Store Service" -partitionmode:$false -sharing:$false -databaseserver $DbServerAddress -databasename "SSO" -applicationpool $app -auditingEnabled:$true -auditlogmaxsize 30

$proxy = $serviceapp | New-SPSecureStoreServiceApplicationProxy -defaultproxygroup:$true -name "Secure Store Service Proxy"

Update-SPSecureStoreMasterKey -ServiceApplicationProxy $proxy -Passphrase $farmPassPhrase

Start-Sleep -s 5

Update-SPSecureStoreApplicationServerKey -ServiceApplicationProxy $proxy -Passphrase $farmPassPhrase

$searchapp = New-SPEnterpriseSearchServiceApplication -name "Search Service Application" -applicationpool $app

$proxy = New-SPEnterpriseSearchServiceApplicationProxy -name "Search Service Application Proxy" -searchapplication $searchapp

$si = Get-SPEnterpriseSearchServiceInstance -local

Set-SPEnterpriseSearchAdministrationComponent -searchapplication $searchapp  -searchserviceinstance $si

$ct = $searchapp | New-SPEnterpriseSearchCrawlTopology

$crawlStore = $searchApp.CrawlStores | where {$_.Name -eq "Search_Service_Application_CrawlStore"}

New-SPEnterpriseSearchCrawlComponent -searchapplication $searchapp -crawltopology $ct -searchserviceinstance $si -crawldatabase $crawlstore

$ct | Set-SPEnterpriseSearchCrawlTopology -active

Write-Host -ForegroundColor Yellow "Waiting on Crawl Components to provision..."

while ($true) {

$ct = Get-SPEnterpriseSearchCrawlTopology -Identity $ct -SearchApplication $searchApp

$state = $ct.CrawlComponents | where {$_.State -ne "Ready"}

if ($ct.State -eq "Active" -and $state -eq $null) {

break

}

Write-Host -ForegroundColor Yellow "Waiting on Crawl Components to provision..."

Start-Sleep 2

}

$qt = $searchapp | New-SPEnterpriseSearchQueryTopology -partitions 1

$p1 = ($qt | Get-SPEnterpriseSearchIndexPartition)

New-SPEnterpriseSearchQueryComponent -indexpartition $p1 -querytopology $qt -searchserviceinstance $si

$p1 | Set-SPEnterpriseSearchIndexPartition

$propertyStore = $searchApp.PropertyStores | where {$_.Name -eq "Search_Service_Application_PropertyStore"}

$p1 | Set-SPEnterpriseSearchIndexPartition -PropertyDatabase $propertyStore.Id.ToString()

$qt | Set-SPEnterpriseSearchQueryTopology –active

Your done, enjoy!
Chris Givens aka CJG

Published Wednesday, March 31, 2010 9:25 PM by cjg
Filed under: ,

Comments

 

hientx said:

Thank you Chris. I will definitely try it out today.

March 31, 2010 2:09 PM
 

hientx said:

I'm on Beta. This cmdlet New-SPServiceApplicationPool is not available :).

March 31, 2010 11:52 PM
 

Blog del CIIN said:

Siguiendo con la serie de recopilatorios sobre recursos interesantes en torno a SharePoint 2010, os dej&oacute;

April 1, 2010 12:24 AM
Anonymous comments are disabled

This Blog

Syndication

Powered by Community Server, by Telligent Systems