Thursday, July 11, 2013

Install SharePoint 2013

שלום חברים,
אפרט מניסיוני על התקנת חווה של SharePoint 2013 . חוות ה-SharePoint שהתקנתי מורכבת מ-2 שרתים, האחד FE  והשני DB.
השרתים עליהם התקנתי את ה-SharePoint היו שרתי Windows Server 2012, וה-SQL היה בגרסת SQL Server 2012 (SP1).

טיפ: הורידו את כל העדכונים האחרונים לשרת לפני שאתם מתחילים את ההתקנה, גם עדכונים של מערכת ההפעלה (Windows Update) וגם עדכונים של Microsoft (Microsoft Updates, עדכונים למוצרי Microsoft שמותקנים בשרת). בצעו את העדכונים עד שלא יופיעו עדכונים בחלון. ) תידרשו לבצע מספר אתחולים, תלוי במספר העדכונים שהשרת צריך לבצע)

החווה הייתה מורכבת מ-2 שרתים וירטואלים כך שה-FE  היה עם 8GB  - RAM, 4 ליבות ו-80GB לדיסק מערכת ההפעלה, בנוסף שרת DB  עם 16 GB  - RAM, 8 ליבות  ו-80GB לדיסק מערכת ההפעלה ועוד 200 GB דיסק Data ו-60GB ל-Logs.

הגדרתי -3 Users לחווה:
SPAdmin:
ההרשאות שנדרש לקבל:
1.       חבר בקבוצת מנהלי המערכת בכל שרת שבו התקנה פועלת. (Administrators)





2.       חבר בתפקידים הבאים של SQL Server : (Server roles)
a.       Securityadmin
b.       Dbcreator
c.       אם אתם מפעילים רכיבי cmdlet של Windows PowerShell המשפיעים על מסד נתונים, חשבון זה חייב להיות חבר בתפקיד הקבוע db_owner עבור מסד הנתונים.

SPservices:
ההרשאות שנדרש לקבל:
1.       חבר בתפקידים הבאים של SQL Server : (Server roles)
לאחר שתפעיל את אשף התצורה של  SharePoint(Configuration Wizard)
a.       Securityadmin
b.       Dbcreator
c.        db_owner עבור כל ה- DBים של SharePoint במסד הנתונים.


SPAppPool


התחלתי את ההתקנה של ה- prerequisiteinstaller , לחצתי Double Click  על הקובץ ולאחר מכן לחצתי "Yes".





לחצתי על Next ולאחר מכן אישרתי את התנאים...






ההתקנה התחילה (במידה ואין לכם חיבור לאינטרנט יש להוריד את הרכיבים ברשימה ולהתקין אותם עצמאית ,ניתן להיעזר במאמר הזה). 





הודעת Reset למכונה הופיעה לחצתי על "אישור".

לאחר שהתחברתי מחדש למכונה קפץ לי חלון התראה להמשך התקנה, לחצתי על "Yes".



החלון של Microsoft SharePoint 2013 Products Preparation Tool הוצג וההתקנה נמשכה, ההתקנה הסתיימה בהצלחה ושוב הצטרכתי לבצע Reset.






שוב חלון ההתראה קפץ ולחיצה על Yes המשיכה לי את ההתקנה, התהליך היה מהיר מאוד וההתקנה הסתיימה. 





מומלץ לבדוק ששני ה-Roleים התווספו (IIS/App Server).



מיד לאחר מכן הפעלתי את ההתקנה של SharePoint, לחצתי על הקובץ Setup פעמיים ונפתח לי חלון תפריט של ההתקנה.





 לחצתי Install SharePoint Server ו- חלון של User Account Control קפץ, לחצתי "Yes".


חלון Enter your Product Key מוצג, הכנסתי את ה- Product Key ולחצתי על "המשך". 




קיבלתי את התנאים...  ולחצתי על המשך. 



חלון Server Type הוצג ובחרתי באופציה Complete ולאחר מכן עברתי ללשונית File Location כדי לבחור נתיב לקבציי ה-Index (במידה ומופעל שירות החיפוש).




 לחיצה על "התקנה" וההתקנה מתחילה ...



 בסוף ההתקנה מופיע חלון Run Configuration Wizard בחרתי שלא להריץ את ה- Configuration Wizard  ולא סימנתי את תיבת הסימון,  לאחר מכן סגרתי את החלון.




יצרתי SharePoint Config Database בעזרת PowerShell : נעזרתי במאמר הזה
המוטיבציה ליצור SharePoint Config בעזרת PowerShell היא ערבוב של מס' Databaseים ב-SQL ריכוזי שיכול להכיל גם Databaseים של SharePoint2010 ו – SharePoint 2013 , ה- Databaseים שנוצרים בתהליך ההתקנה האוטומטי נוצרים עם Guidים מה שמקשה על זיהוי DBים, חוסר אסטטיקה ובעיות עם DBים שמוכל בהם התו " " (רווח).
להלן ה-Script :

#====================================
#====================================
#Provision Configuration and Administration DataBases
#====================================
#====================================

Add-PSSnapin Microsoft.SharePoint.PowerShell

#This is the name of your SQL Alias
#----------------------------------------------

$AliasName = "Write Here The Alias Name if you Use Alias"
<#If you don't use Alias, You Cane Delete this Command#>

# Farm configuration
#----------------------------------------------

$configDbName = "SharePointConfig2013"
$AdminContentDB = "SharePointAdminContent2013"
$DBServer = "Server Name" # Change the Text between the quotation 
$FarmAccount = "Domain\UserName" # Change the Text between the quotation
$FarmCredential = Get-Credential -credential $FarmAccount

Write-Warning "Enter Passphrase"
$Passphrase = ConvertTo-SecureString "WackyWi11y" -AsPlainText -Force


# Create SharePoint Config DataBase
#------------------------------------------------
Write-Host "Creating new configuration database..." -foregroundcolor Cyan
New-SPConfigurationDatabase -DatabaseName $configDbName -DatabaseServer $DBServer -AdministrationContentDatabaseName $AdminContentDB -Passphrase $Passphrase -FarmCredentials $FarmCredential

Write-Host "SharePoint Configuration Database was create Successfully ! " -foregroundcolor Green



ניגשתי לשרת ה-SQL ובדקתי שה-DBים אכן נוצרו והפלא ופלא הם אכן נוצרו !




בשלב הבא הרצתי את ה- Configuration Wizard  , החלון הופיע ולחצי על Next,



 החלון שמזהיר על Serviceים שהתחילו או יאותחלו הופיע ולחצתי על "Yes



יופיע חלון  Modify server farm Settings רשמתי את שם ה-DB ובחרתי ב-SharePoint Config שהתקנתי מקודם בעזרת ה-PowerShell. בחרתי באופציה "Don't Disconnect from this server farm"  ולחצתי Next.



החלון Configure SharePoint Central Administration Web Application מופיע , שניתי את ה-Port ל- 50000 ובחרתי ב-NTLM



לחיצה על Next הובילה אותי לחלון Completing the SharePoint Products Configuration Wizard בו מוצגים כל ההגדרות הרלוונטיות, 



לחיצה על Next וה- Configuration Wizard החל לרוץ.



במידה והכול הולך קשורה החלון הבא יופיע בסיום הריצה Configuration Successful, לחצתי על Finish ומיד לאחר מכן ה- Central Admin נטען.







הדף Help Make SharePoint Better מופיע, בחרתי ב-No ולחצתי על OK. הדף Welcome מוצג בחרתי ב-Cancel ולאחר מכן הופיעה-Central Admin.
בגדול ההתקנה הסתיימה, במידה ותרצו להמשיך להתקין Service Application ניתן לעשות זאת דרך ה-Central Admin או בעזרת PowerShell.
יש להתקין את ה-Service Application הבאים : (אני בחרתי בדרך השנייה - PowerShell)
State Service Application:

The State Service is a shared service that is used by some Microsoft SharePoint Server 2010 components to store temporary data across related HTTP requests in a SQL Server database

#====================================
 #====================================
 #Provision State Service Application
 #====================================
 #====================================

 #Create and Initialoze the State Service Database
 #----------------------------------------------------------------

 Write-host "Step 1 : Create and Initialoze the State Service Database " -foregroundcolor Cyan
 $dbServer = "Server Name" # Change the Text between the quotation, if you Use Alias Method Write the Alias Name
 $dbName = "State_Service_DB"
 $db = Get-SPStateServiceDatabase $dbName
 if($db -eq $null)
 {
   $db = New-SPStateServiceDatabase -Name $dbName -DatabaseServer $dbServer -Weight 1
   $db | Initialize-SPStateServiceDatabase
 }
 else
 {
 Write-host "There is a Database with the same name .. please change the name !" -foregroundcolor Red
 }


 #Create the Service Application
 #----------------------------------------------------------------

 Write-host "Step 2 : Create the Service Application " -foregroundcolor Cyan
 $appName = "State Services Service Application"
 $app = Get-SPStateServiceApplication $appName
 if($app -eq $null)
 {
 $app = New-SPStateServiceApplication -Name $appName -Database $db
 }
 else
 {
 Write-host "There is a Service Application with the same name .. please change the name !" -foregroundcolor Red
 }


 #Create the Service Application Proxy
 #----------------------------------------------------------------

 Write-host "Step 2 : Create the Service Application Proxy " -foregroundcolor Cyan
 $proxyName = "$($app.Name) Proxy"
 $proxy = New-SPStateServiceApplicationProxy -ServiceApplication $app -Name $proxyName -DefaultProxyGroup



Search Service Application:


#====================================
#====================================
#Provision Search Service Application
#====================================
#====================================


#set the name for the Service Application
#----------------------------------------------------------
$serviceAppName = "Search Service Application"


#Set the server names for core pieces
#------------------------------------------------------
$serverName = "Server Name"        #Admin/Index
$queryserverName = "Server Name"      #Query
$dbserverName = "Server Name"          #DB

<# if you are install all the component on one server just the server name and delete the other from the script,
don't forget to chanage the server names in the script below #>


#IndexLocation
#-----------------------------
$IndexLocation = "F:\Data\Search15Index” #Location must be empty, will be deleted during the process! 
mkdir -Path $IndexLocation -Force

#Search component
#-----------------------------
$adminServer = $serverName   #recommended that the component be locate alongside a Crawl Component
$crawlServer = $serverName
$queryServer = $queryserverName
$dbServer = $dbserverName      #Change the value if you have Seperate SQL Server
$searchDBName = "SearchServiceApplication"

#Define Service Account / ApplicationPool Account
#--------------------------------------------------------------------------
Write-Host "Step 1 : Define Service Account" -foregroundcolor Cyan
$searchCred = "Domain\UserAccount"    #Repalce The Text With Real Account
$cred = Get-Credential $searchCred
$searchSvcAccount = Get-SPManagedAccount $cred.UserName -ErrorAction SilentlyContinue

if($searchSvcAccount -eq $null)
{
     $searchSvcAccount = New-SPManagedAccount $cred
}


Write-Host "Step 2 : Define Application Pool Account" -foregroundcolor Cyan
$AppPoolsearchCred = "Domain\UserAccount"   #Repalce The Text With Real Account
$cred = Get-Credential $AppPoolsearchCred
$searchAppPoolAccount = Get-SPManagedAccount $cred.UserName -ErrorAction SilentlyContinue

if($searchAppPoolAccount -eq $null)
{
     $searchAppPoolAccount = New-SPManagedAccount $cred
}


<#One additional account that you will need is the default content access account.
  this account should not be a managed account and therefore requires no additional congiuration steps #>


#Get Search Service Instance if exist
#-----------------------------------------
Write-Host "Step 3 : Get Search Service Instance if exist" -foregroundcolor Cyan
$searchSvc = Get-SPEnterpriseSearchServiceInstance -Local
if($searchSvc -eq $null)
{
  throw "Unable to Retrive Search Service"
}


#Start the search service
#-----------------------------------------
Write-Host "Step 4 : Start the search service" -foregroundcolor Cyan
if($searchSvc.Status -ne "Online")
{
  $searchSvc | Start-SPServiceInstance
  Write-Host "the search service is  now Online" -Foregroundcolor Green
}
else
{
  Write-Host "the search service is already Online" -Foregroundcolor Yellow
}



#Configure the search Service
#-----------------------------------------
Write-Host "Step 5 : Configure the search Service" -foregroundcolor Cyan
$contactEmail = "mailAdress@SharePoint.com"
$connectionTimeOut = "60"
$acknowledgementTimeOut = "60"
$proxyType = "Default"
$ignoreSSLWranings = $false
$internetID = $null
$performanceLevel = "PartlyReduced"

Write-Host "Step 6 : Setting search service properties..." -foregroundcolor Yellow

while($true)
{
 $svc = Get-SPEnterpriseSearchService
 $svc | Set-SPEnterpriseSearchService -ServiceAccount $searchSvcManagedAccount.UserName -ServicePassword $searchSvcAccount.Password -ContactEmail $contactEmail -connectionTimeOut $connectionTimeOut -acknowledgementTimeOut $acknowledgementTimeOut -proxyType $proxyType -ignoreSSLWarnings $ignoreSSLWranings -internetIdentity $internetID -performanceLevel $performanceLevel -ErrorAction SilentlyContinue -ErrorVariable err
 if($err)
 {
   if($err[0].Exception.Message -like "*update conflict")
    {
  Write-Warning "An Update conflict occured"
  Start-Sleep 2
  continue
    }
  
    throw $err
 }

 break
}


Write-Host " Configure search service ended " -foregroundcolor Green



#Create Search Service Application
#--------------------------------------------------
Write-Host "Step 7 : Create $serviceAppName " -foregroundcolor Cyan

$searchApp = Get-SPEnterpriseSearchServiceApplication $serviceAppName -ErrorAction SilentlyContinue

$poolName = "Search Service Application Pool"
$AdminPoolName = "Search Service Application Admin Pool"

$saAppPool = New-SPServiceApplicationPool -Name $poolName -Account $searchAppPoolAccount
$saAdminAppPool = New-SPServiceApplicationPool -Name $AdminPoolName -Account $searchAppPoolAccount

Write-Host "Creating Search Service Application Now... " -foregroundcolor yellow
$searchApp = New-SPEnterpriseSearchServiceApplication -Name $serviceAppName -ApplicationPool $saAppPool -AdminApplicationPool $saAdminAppPool -DataBaseServer $dbServer -DataBaseName $searchDBName

Write-Host "Please wait while the Search Service Application are Creating... " -foregroundcolor yellow
Start-Sleep -s 30

if($searchApp -ne $null)
{
  Write-Host "Search Service Application Created Successfully ! " -foregroundcolor Green
}
else
{
  Write-Host "Search Service Application dosen't Created Successfully ! " -foregroundcolor Red
}


#Create the Service Application Proxy
#-----------------------------------------
Write-Host "Step 7 : Create the Service Application Proxy" -foregroundcolor Cyan

$searchProxy = New-SPEnterpriseSearchServiceApplicationProxy -Name "$serviceAppName Proxy" -SearchApplication $searchApp

Write-Host "Please wait while the Search Service Application are Creating... " -foregroundcolor yellow
Start-Sleep -s 10

if($searchProxy -ne $null)
{
  Write-Host "Search Service Application Proxy Created Successfully ! " -foregroundcolor Green
}
else
{
  Write-Host "Search Service Application Proxy dosen't Created Successfully ! " -foregroundcolor Red
}



# Clone the default Topology (which is empty) and create a new one and then activate it 
#----------------------------------------------------------------------------------------
Write-Host "Step 8 : Configuring Search Component Topology...." -foregroundcolor Cyan 
$clone = $searchApp.ActiveTopology.Clone()
$SearchServiceInstance = Get-SPEnterpriseSearchServiceInstance -Local



#Configure the Administration Component
#--------------------------------------------------------------
Write-Host "Step 9 : Configure the Administration Component" -foregroundcolor Cyan
Write-Host "Starting the Instanec and Admin Component ..." -foregroundcolor Yellow

New-SPEnterpriseSearchAdminComponent –SearchTopology $clone -SearchServiceInstance $SearchServiceInstance
Start-Sleep -s 5

Write-Host " Configure Administration Component ended " -foregroundcolor Green



#Create the Crawl Component
#---------------------------
Write-Host "Step 10 : Create the Crawl Components" -foregroundcolor Cyan

Write-Host "=== Crawl Component ===" -foregroundcolor Cyan

New-SPEnterpriseSearchCrawlComponent –SearchTopology $clone -SearchServiceInstance $SearchServiceInstance

Write-Host " Configure Crawl Component ended " -foregroundcolor Green

<# It is important to wait until the process of Crawl initiation will be finished
   After it done you can initiate the query Component #>

Start-Sleep -s 30


#Create the ContentProcessing Component
#----------------------------------------
Write-Host "=== ContentProcessing Component ===" -foregroundcolor Cyan

New-SPEnterpriseSearchContentProcessingComponent –SearchTopology $clone -SearchServiceInstance $SearchServiceInstance

Start-Sleep -s 15

Write-Host " Configure ContentProcessing Component ended " -foregroundcolor Green





#Create the AnalyticsProcessing Component
#------------------------------------------
Write-Host "=== AnalyticsProcessing Component ===" -foregroundcolor Cyan

New-SPEnterpriseSearchAnalyticsProcessingComponent –SearchTopology $clone -SearchServiceInstance $SearchServiceInstance

Start-Sleep -s 15

Write-Host " Configure AnalyticsProcessing Component ended " -foregroundcolor Green



#Create the Index Component
#---------------------------
Write-Host "=== SearchIndex Component ===" -foregroundcolor Cyan

New-SPEnterpriseSearchIndexComponent –SearchTopology $clone -SearchServiceInstance $SearchServiceInstance

Start-Sleep -s 15

Write-Host " Configure Search Index Component ended " -foregroundcolor Green



#Create the Query Component
#---------------------------
Write-Host "=== AnalyticsProcessing Component ===" -foregroundcolor Cyan

New-SPEnterpriseSearchQueryProcessingComponent –SearchTopology $clone -SearchServiceInstance $SearchServiceInstance

Write-Host " Configure AnalyticsProcessing Component ended " -foregroundcolor Green


$clone.Activate()

Write-Host " ======== The End ========" -foregroundcolor Green





ניתן לבדוק שה-Service Application התווסף דרך ממשק ה-Central Admin , כנסו ל- Central Administration בחר ב- Application Management ולאחר מכן בManage service applications אתם אמורים לראות את הService Application  שיצרתם ברשימה.



אפשר להמשיך וליצור WebApplication דרך ה-Central Admin רק תקפידו בזמן היצירה לתת שם אינטואיטיבי ל-DB של ה-WebApplication.

בנוסף יש עוד מס' צעדים שרצוי לבצע כדי שהחווה תרוץ בצורה מיטבית : 
1. הוספת ערך ב-Registry של DisableLoopbackCheck - לינק למאמר.
2. יצירת WebApplication עם hostheader.

3. עריכת קובץ Host , הוספת ה-IP של המכונה עצמה לכתובת של ה-Site ב-IIS (לצורך העניין ל-host header שהוספתם כשייצרתם WebApplication, ללא הקידומת http://)


בהצלחה !

רון נס.


============================================================================================================================================================================================================================================================



Hello Friends,

Today I will talk about my experience on installing SharePoint 2013 farm. The SharePoint I installed consists of 2 servers, one FE and the other DB.
The Servers that I installed were with Windows Server 2012, and SQL was SQL Server version 2012 (SP1).

Tip: Download the latest Windows Update and microsoft updates before you start the installation. Do the updates until updates will not appear in the window. you Will be required to reboot, depending on the number of updates that the server should perform.

The farm consisted of 2 virtual servers so that the FE was with 8GB - RAM, 4 cores and 80GB operating system disk, in addition to DB server with 16 GB - RAM, 8 cores and 80GB operating system disk and 200 GB Data Disk and -60GB to Logs.

3 Users defined:
SPAdmin:
Permissions required:
First. Member of the Administrators group on each server where the installation operates. (Administrators)





Two. A member of the following roles in SQL Server: (Server roles)
a. Securityadmin
b. Dbcreator
c. If you run cmdlets Windows PowerShell affect a database, this account must be a member of the db_owner fixed role for the database.

SPservices:
Permissions required:
1. A member of the following roles in SQL Server: (Server roles)
After you run the SharePoint Configuration Wizard (Configuration Wizard)
a. Securityadmin
b. Dbcreator
c. db_owner for all the children of the SharePoint DB database.


SPAppPool:


I started the installation of the prerequisiteinstaller, pressed Double Click on the file and then clicked "Yes".



Clicked Next and then confirmed the conditions ... 


Installation started (if you have no Internet connection to download the components list and install them independently, you can use this article). Reset machine message appeared I clicked on "OK".




After I connected the new machine I jumped further alert window installation, I clicked on "Yes".


Window of the Microsoft SharePoint 2013 Products Preparation Tool was displayed and continued the installation, the installation was successful and I had to reset again.




Alarm window jumped again and clicking Yes I continued the installation, the process was very quick and the installation is complete.



 Recommended to check that both the added s Role (IIS / App Server).


Immediately after I activated the SharePoint installation, I clicked on the setup file twice and it opened a window installation menu. I clicked Install SharePoint Server and Window's User Account Control jumped, I clicked "Yes".






The Window Enter your Product Key is displayed, I put the Product Key and clicked "Continue". 



I got the conditions ... And clicked Continue. The Window Server Type was introduced and I opted Complete, and then I moved to the File Location tab to select the file path reservation (when powered search service). 



Clicking on "Install" and the installation begins ... At the end of the installation The window that appears was Run Configuration Wizard I chose not to run the Configuration Wizard and I marked the checkbox, then closed the window.



I created a SharePoint Config Database with PowerShell: I used this article
The Motivation to create "SharePoint Config" with PowerShell is a mixture Numbers of Databases, SQL concentrations can also contain Databases of ​​SharePoint2010 and SharePoint 2013, the Databases that are created during the installation process auto-created with Guides making it difficult to identify, lack of aesthetics and problems with DB is contained in character "" (space).
The following script:

#====================================
#====================================
#Provision Configuration and Administration DataBases
#====================================
#====================================

Add-PSSnapin Microsoft.SharePoint.PowerShell

#This is the name of your SQL Alias
#----------------------------------------------

$AliasName = "Write Here The Alias Name if you Use Alias"
<#If you don't use Alias, You Cane Delete this Command#>

# Farm configuration
#----------------------------------------------

$configDbName = "SharePointConfig2013"
$AdminContentDB = "SharePointAdminContent2013"
$DBServer = "Server Name" # Change the Text between the quotation 
$FarmAccount = "Domain\UserName" # Change the Text between the quotation
$FarmCredential = Get-Credential -credential $FarmAccount

Write-Warning "Enter Passphrase"
$Passphrase = ConvertTo-SecureString "WackyWi11y" -AsPlainText -Force


# Create SharePoint Config DataBase
#------------------------------------------------
Write-Host "Creating new configuration database..." -foregroundcolor Cyan
New-SPConfigurationDatabase -DatabaseName $configDbName -DatabaseServer $DBServer -AdministrationContentDatabaseName $AdminContentDB -Passphrase $Passphrase -FarmCredentials $FarmCredential

Write-Host "SharePoint Configuration Database was create Successfully ! " -foregroundcolor Green




I went to the SQL server and checked that the DBs actually created and lo and behold they actually were!


Next I ran the Configuration Wizard, the window appeared and press Next


, the window warns the Services started or boots appeared and I clicked on "Yes"



 window appears Modify server farm Settings I wrote the name of the DB and chose the name of SharePoint Config I installed before using the PowerShell. I chose the option "Do not disconnect from this server farm" and clicked Next.



The window Configure SharePoint Central Administration Web Application appears, I type in the Port field 50000 and I chose NTLM, click Next 



led me to the window Completing the SharePoint Products Configuration Wizard showing all relevant settings, clicking Next and - Configuration Wizard from running.




If all goes well, the following window will appear Configuration Successful, I clicked Finish and immediately after this Central Admin uploaded.






The Page Help Make SharePoint Better listed, I chose No in and clicked OK. The Welcome page is displayed on and I chose Cancel and then the Central Admin appeared.
The installation is complete, if you want to continue and install Service Application it can be done through the Central Admin or using PowerShell.
Install the following Application Service: (I chose the second way - PowerShell)
State Service Application:

THE STATE SERVICE IS A SHARED SERVICE THAT IS USED BY SOME MICROSOFT SHAREPOINT SERVER 2010 COMPONENTS TO TEMPORARY STORE RELATED DATA ACROSS HTTP REQUESTS IN A SQL SERVER DATABASE

#====================================
 #====================================
 #Provision State Service Application
 #====================================
 #====================================

 #Create and Initialoze the State Service Database
 #----------------------------------------------------------------

 Write-host "Step 1 : Create and Initialoze the State Service Database " -foregroundcolor Cyan
 $dbServer = "Server Name" # Change the Text between the quotation, if you Use Alias Method Write the Alias Name
 $dbName = "State_Service_DB"
 $db = Get-SPStateServiceDatabase $dbName
 if($db -eq $null)
 {
   $db = New-SPStateServiceDatabase -Name $dbName -DatabaseServer $dbServer -Weight 1
   $db | Initialize-SPStateServiceDatabase
 }
 else
 {
 Write-host "There is a Database with the same name .. please change the name !" -foregroundcolor Red
 }


 #Create the Service Application
 #----------------------------------------------------------------

 Write-host "Step 2 : Create the Service Application " -foregroundcolor Cyan
 $appName = "State Services Service Application"
 $app = Get-SPStateServiceApplication $appName
 if($app -eq $null)
 {
 $app = New-SPStateServiceApplication -Name $appName -Database $db
 }
 else
 {
 Write-host "There is a Service Application with the same name .. please change the name !" -foregroundcolor Red
 }


 #Create the Service Application Proxy
 #----------------------------------------------------------------

 Write-host "Step 2 : Create the Service Application Proxy " -foregroundcolor Cyan
 $proxyName = "$($app.Name) Proxy"
 $proxy = New-SPStateServiceApplicationProxy -ServiceApplication $app -Name $proxyName -DefaultProxyGroup




Search Service Application:
#====================================
#====================================
#Provision Search Service Application
#====================================
#====================================


#set the name for the Service Application
#----------------------------------------------------------
$serviceAppName = "Search Service Application"


#Set the server names for core pieces
#------------------------------------------------------
$serverName = "Server Name"        #Admin/Index
$queryserverName = "Server Name"      #Query
$dbserverName = "Server Name"          #DB

<# if you are install all the component on one server just the server name and delete the other from the script,
don't forget to chanage the server names in the script below #>


#IndexLocation
#-----------------------------
$IndexLocation = "F:\Data\Search15Index” #Location must be empty, will be deleted during the process! 
mkdir -Path $IndexLocation -Force

#Search component
#-----------------------------
$adminServer = $serverName   #recommended that the component be locate alongside a Crawl Component
$crawlServer = $serverName
$queryServer = $queryserverName
$dbServer = $dbserverName      #Change the value if you have Seperate SQL Server
$searchDBName = "SearchServiceApplication"

#Define Service Account / ApplicationPool Account
#--------------------------------------------------------------------------
Write-Host "Step 1 : Define Service Account" -foregroundcolor Cyan
$searchCred = "Domain\UserAccount"    #Repalce The Text With Real Account
$cred = Get-Credential $searchCred
$searchSvcAccount = Get-SPManagedAccount $cred.UserName -ErrorAction SilentlyContinue

if($searchSvcAccount -eq $null)
{
     $searchSvcAccount = New-SPManagedAccount $cred
}


Write-Host "Step 2 : Define Application Pool Account" -foregroundcolor Cyan
$AppPoolsearchCred = "Domain\UserAccount"   #Repalce The Text With Real Account
$cred = Get-Credential $AppPoolsearchCred
$searchAppPoolAccount = Get-SPManagedAccount $cred.UserName -ErrorAction SilentlyContinue

if($searchAppPoolAccount -eq $null)
{
     $searchAppPoolAccount = New-SPManagedAccount $cred
}


<#One additional account that you will need is the default content access account.
  this account should not be a managed account and therefore requires no additional congiuration steps #>


#Get Search Service Instance if exist
#-----------------------------------------
Write-Host "Step 3 : Get Search Service Instance if exist" -foregroundcolor Cyan
$searchSvc = Get-SPEnterpriseSearchServiceInstance -Local
if($searchSvc -eq $null)
{
  throw "Unable to Retrive Search Service"
}


#Start the search service
#-----------------------------------------
Write-Host "Step 4 : Start the search service" -foregroundcolor Cyan
if($searchSvc.Status -ne "Online")
{
  $searchSvc | Start-SPServiceInstance
  Write-Host "the search service is  now Online" -Foregroundcolor Green
}
else
{
  Write-Host "the search service is already Online" -Foregroundcolor Yellow
}



#Configure the search Service
#-----------------------------------------
Write-Host "Step 5 : Configure the search Service" -foregroundcolor Cyan
$contactEmail = "MailAdrees@SharePoint.com"
$connectionTimeOut = "60"
$acknowledgementTimeOut = "60"
$proxyType = "Default"
$ignoreSSLWranings = $false
$internetID = $null
$performanceLevel = "PartlyReduced"

Write-Host "Step 6 : Setting search service properties..." -foregroundcolor Yellow

while($true)
{
 $svc = Get-SPEnterpriseSearchService
 $svc | Set-SPEnterpriseSearchService -ServiceAccount $searchSvcManagedAccount.UserName -ServicePassword $searchSvcAccount.Password -ContactEmail $contactEmail -connectionTimeOut $connectionTimeOut -acknowledgementTimeOut $acknowledgementTimeOut -proxyType $proxyType -ignoreSSLWarnings $ignoreSSLWranings -internetIdentity $internetID -performanceLevel $performanceLevel -ErrorAction SilentlyContinue -ErrorVariable err
 if($err)
 {
   if($err[0].Exception.Message -like "*update conflict")
    {
  Write-Warning "An Update conflict occured"
  Start-Sleep 2
  continue
    }
  
    throw $err
 }

 break
}


Write-Host " Configure search service ended " -foregroundcolor Green



#Create Search Service Application
#--------------------------------------------------
Write-Host "Step 7 : Create $serviceAppName " -foregroundcolor Cyan

$searchApp = Get-SPEnterpriseSearchServiceApplication $serviceAppName -ErrorAction SilentlyContinue

$poolName = "Search Service Application Pool"
$AdminPoolName = "Search Service Application Admin Pool"

$saAppPool = New-SPServiceApplicationPool -Name $poolName -Account $searchAppPoolAccount
$saAdminAppPool = New-SPServiceApplicationPool -Name $AdminPoolName -Account $searchAppPoolAccount

Write-Host "Creating Search Service Application Now... " -foregroundcolor yellow
$searchApp = New-SPEnterpriseSearchServiceApplication -Name $serviceAppName -ApplicationPool $saAppPool -AdminApplicationPool $saAdminAppPool -DataBaseServer $dbServer -DataBaseName $searchDBName

Write-Host "Please wait while the Search Service Application are Creating... " -foregroundcolor yellow
Start-Sleep -s 30

if($searchApp -ne $null)
{
  Write-Host "Search Service Application Created Successfully ! " -foregroundcolor Green
}
else
{
  Write-Host "Search Service Application dosen't Created Successfully ! " -foregroundcolor Red
}


#Create the Service Application Proxy
#-----------------------------------------
Write-Host "Step 7 : Create the Service Application Proxy" -foregroundcolor Cyan

$searchProxy = New-SPEnterpriseSearchServiceApplicationProxy -Name "$serviceAppName Proxy" -SearchApplication $searchApp

Write-Host "Please wait while the Search Service Application are Creating... " -foregroundcolor yellow
Start-Sleep -s 10

if($searchProxy -ne $null)
{
  Write-Host "Search Service Application Proxy Created Successfully ! " -foregroundcolor Green
}
else
{
  Write-Host "Search Service Application Proxy dosen't Created Successfully ! " -foregroundcolor Red
}



# Clone the default Topology (which is empty) and create a new one and then activate it 
#----------------------------------------------------------------------------------------
Write-Host "Step 8 : Configuring Search Component Topology...." -foregroundcolor Cyan 
$clone = $searchApp.ActiveTopology.Clone()
$SearchServiceInstance = Get-SPEnterpriseSearchServiceInstance -Local



#Configure the Administration Component
#--------------------------------------------------------------
Write-Host "Step 9 : Configure the Administration Component" -foregroundcolor Cyan
Write-Host "Starting the Instanec and Admin Component ..." -foregroundcolor Yellow

New-SPEnterpriseSearchAdminComponent –SearchTopology $clone -SearchServiceInstance $SearchServiceInstance
Start-Sleep -s 5

Write-Host " Configure Administration Component ended " -foregroundcolor Green



#Create the Crawl Component
#---------------------------
Write-Host "Step 10 : Create the Crawl Components" -foregroundcolor Cyan

Write-Host "=== Crawl Component ===" -foregroundcolor Cyan

New-SPEnterpriseSearchCrawlComponent –SearchTopology $clone -SearchServiceInstance $SearchServiceInstance

Write-Host " Configure Crawl Component ended " -foregroundcolor Green

<# It is important to wait until the process of Crawl initiation will be finished
   After it done you can initiate the query Component #>

Start-Sleep -s 30


#Create the ContentProcessing Component
#----------------------------------------
Write-Host "=== ContentProcessing Component ===" -foregroundcolor Cyan

New-SPEnterpriseSearchContentProcessingComponent –SearchTopology $clone -SearchServiceInstance $SearchServiceInstance

Start-Sleep -s 15

Write-Host " Configure ContentProcessing Component ended " -foregroundcolor Green





#Create the AnalyticsProcessing Component
#------------------------------------------
Write-Host "=== AnalyticsProcessing Component ===" -foregroundcolor Cyan

New-SPEnterpriseSearchAnalyticsProcessingComponent –SearchTopology $clone -SearchServiceInstance $SearchServiceInstance

Start-Sleep -s 15

Write-Host " Configure AnalyticsProcessing Component ended " -foregroundcolor Green



#Create the Index Component
#---------------------------
Write-Host "=== SearchIndex Component ===" -foregroundcolor Cyan

New-SPEnterpriseSearchIndexComponent –SearchTopology $clone -SearchServiceInstance $SearchServiceInstance

Start-Sleep -s 15

Write-Host " Configure Search Index Component ended " -foregroundcolor Green



#Create the Query Component
#---------------------------
Write-Host "=== AnalyticsProcessing Component ===" -foregroundcolor Cyan

New-SPEnterpriseSearchQueryProcessingComponent –SearchTopology $clone -SearchServiceInstance $SearchServiceInstance

Write-Host " Configure AnalyticsProcessing Component ended " -foregroundcolor Green


$clone.Activate()

Write-Host " ======== The End ========" -foregroundcolor Green




You can check that if the service applications was added through the Central Admin, go to Central Administration select Application Management and then on Manage service applications you should see the Service Application you created in the list.



You can go ahead and create WebApplication via the Central Admin but take care while creating chooses an intuitive name for the DB's to the WebApplication.

In addition there is another number things that we should make  to farm run optimally:
1. Adding value tothe Registry of DisableLoopbackCheck - link to the article.
2. Create WebApplication with hostheader.
3. Editing Host File, add the IP address of the machine itself the site in IIS (for that matter to the host header you added when you've generated WebApplication without http:// prefix)

Good Luck :)

Ron Ness.

No comments:

Post a Comment