Thursday, June 13, 2013

Configure SharePoint 2010 Service application using Powershell

Below script will create services for office web apps

Word Viewing Service Application
Excel Service Application
PowerPoint Service Application

Save this file as .ps1 in your local server folder.
Open SharePoint 2010 Management Shell> create dir local folder path and run it

$saAppPoolName = "SharePoint Web Services"
$saAppPool = Get-SPServiceApplicationPool -Identity $saAppPoolName -EA 0
if($saAppPool -eq $null)
  Write-Host "Creating Service Application Pool..."
  $appPoolAccount = Get-SPManagedAccount -Identity $appPoolUserName -EA 0
  if($appPoolAccount -eq $null)
      Write-Host "Please supply the password for the Service Account..."
      $appPoolCred = Get-Credential $appPoolUserName
      $appPoolAccount = New-SPManagedAccount -Credential $appPoolCred -EA 0
  $appPoolAccount = Get-SPManagedAccount -Identity $appPoolUserName -EA 0
  if($appPoolAccount -eq $null)
    Write-Host "Cannot create or find the managed account $appPoolUserName, please ensure the account exists."
    Exit -1
  New-SPServiceApplicationPool -Name $saAppPoolName -Account $appPoolAccount -EA 0 > $null
Write-Host "Creating Service and Proxy..."
$appPool = Get-SPServiceApplicationPool -Identity "SharePoint Web Services"
New-SPWordViewingServiceApplication -Name "Word Viewing Service Application" -ApplicationPool $appPool | New-SPWordViewingServiceApplicationProxy -Name "Word Viewing Service Application"
New-SPPowerPointServiceApplication -Name "PowerPoint Service Application" -ApplicationPool $appPool | New-SPPowerPointServiceApplicationProxy -Name "PowerPoint Service Application" -AddToDefaultGroup
New-SPExcelServiceApplication -Name "Excel Service Application" -ApplicationPool $appPool

Please see below link for more information

No comments:

Post a Comment