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:
$DbServerAddress = "DBNAME"
$farmPassPhrase = ’Pa$$w0rd’
$svcPwd = ’Pa$$w0rd’
$username =
"CONTOSOSP_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