Monday, August 19, 2013

Provision State Service Application Using PowerShell


שלום חברים,
בהתקנת SharePoint 2010/2013  בעזרת PowerShell ישנו חלק שעלינו ליצור State Service Application. אני חושב שכדאי מאוד לדעת מה אנחנו יוצרים בדיוק ולכן החלטתי להרחיב על State Service Application.
ישנם מספר רכיבים ב-SharePoint שזקוקים לאחסון זמני של נתונים בביצוע בקשות ע"י משתמשים בחווה (הבקשות מבוצעות דרך פרוטוקול HTTP). State Service עוזר לאחסן זמנית את המידע מהבקשות בשרת SQL. דוגמא לרכיבים שמאחסנים מידע זמני : InfoPath Forms, Visio Service, Access Service, Publishing Workflow ו- SharePoint server 2010 Chart Web Part.
לא ניתן להגדיר את ה-State Service דרך ממשק המשתמש, ניתן להגדיר רק דרך Windows PowerShell. ( ניתן להגדיר את ה-State Service דרך אשף התצורה של SharePoint אבל לא מומלץ לעשות זאת)
הצעדים ליצירת State Service Application  הם :
1.       יצירת State Service Application
a.       יצירה ואתחול של State Service Database
b.       יצרה של State Services Service Application
c.       יצירה של State Services Service Application Proxy
2.       בדיקת תקינות של State Service Application

להלן ה-Script :
#====================================
#====================================
#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 = "The Name of the DB Server"
$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


בהצלחה !
רון נס.

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


Hello Friends,
When we Installed SharePoint 2010/2013 using PowerShell we create a State Service Application. I think you'd better know what we create and that is why I decided to expand the State Service Application.
There are several components in SharePoint need for temporary storage of data that requested by users (requests are performed via the HTTP protocol.)
State Service helps to temporarily store information in SQL Serve. Example of components that store temporary information: InfoPath Forms, Visio Service, Access Service, Publishing Workflow and SharePoint server 2010 Chart Web Part.
You cannot configure the State Service through the user interface, you can only set it through Windows PowerShell. (You can configure the State Service through the SharePoint Configuration Wizard but this is not recommended)
Steps to create a State Service Application are:
1. Create a State Service Application
a. Create and format a State Service Database
b. Created the State Services Service Application
c. Create a State Service Application Proxy Services
2. Integrity checking of the State Service Application

The following script:
#====================================
#====================================
#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 = "The Name of the DB Server"
$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


Good Luck J

Ron Ness.

No comments:

Post a Comment