Manage Excel Services with Windows PowerShell (SharePoint Server 2010)

 

Applies to: SharePoint Server 2010, Excel Services (SharePoint 2010)

This topic gives a high-level overview of Windows PowerShell behavior for Excel Services in Microsoft SharePoint Server 2010. Excel Services administrators can use Windows PowerShell to fully script Excel Services setup and deployment, configuration options, and configure all settings during runtime as part of Microsoft SharePoint Server 2010 deployments. Windows PowerShell in Excel Services follows the same naming conventions, style, and behavior guidelines found with other service applications. SharePoint Server provides the Windows PowerShell command-line to carry the administrative actions for Excel Services.

Windows PowerShell for Excel Services

A user must be a member of the global administrator role and also a local administrator to run any Windows PowerShell commands (cmdlets) on a computer. Typically, all Windows PowerShell cmdlets control objects in memory and the Set cmdlets write property values into the configdb data store for the service.

Warning

The stsadm command is not supported in Excel Services. If any stsadm command is used it will fail and an error message is returned to the command prompt.

The Excel Services, Windows PowerShell cmdlets all support the general Windows PowerShell commands. Administrators can pipe the commands, get help on each command, use aliases for commands, filter the results, allow use of the whatif parameter and confirm, and also use variables and parameters with the commands. For more information about Windows PowerShell commands see Excel Services cmdlets (SharePoint Server 2010).

Sample cmdlets for Excel Services

This section shows how to open the SharePoint 2010 Management Shell to perform any of the Excel Services sample cmdlets for Excel Services.

To open the SharePoint 2010 Management Shell

  1. Verify that you meet the following minimum requirements: See Add-SPShellAdmin.

  2. On the Start menu, click All Programs.

  3. Click Microsoft SharePoint 2010 Products.

  4. Click SharePoint 2010 Management Shell.

  5. From the Windows PowerShell command prompt (PS C:\>), type any of the following sample commands and press ENTER:

  • Provisioning a new Excel Services Application with the name “MyExcelServer”
    New-SPExcelServiceApplication -Name "MyExcelServer"

  • Changing the maximum number of sessions per user to 100 for all the remote computers in this farm that are running an Excel Services instance:
    Get-SPExcelServiceApplication | Set-SPExcelServiceApplication -SessionsPerUserMax 100

  • For MyExcelServer, get all trusted locations, and for those that allow data to load from workbooks, force them to use Document Connection Library (DCL) only
    Get-SPExcelServiceApplication -Identity "MyExcelServer" | Get-SPExcelFileLocation | where {$_.ExternalDataAllowed -eq "DclAndEmbedded" } | Set-SPExcelFileLocation -ExternalDataAllowed Dcl

  • Allow workbooks in trusted file locations (and data connections in trusted data connection libraries) to be accessed across domains by Web Parts, Web pages, or Web services, run the Windows PowerShell cmdlet, The following command examples work for all Excel Service applications in your SharePoint Server farm:
    To set to true:
    Get-SPExcelServiceApplication | Set-SPExcelServiceApplication -CrossDomainAccessAllowed
    To set to false:
    Get-SPExcelServiceApplication | Set-SPExcelServiceApplication -CrossDomainAccessAllowed:$false
    To verify:
    (Get-SPExcelServiceApplication).CrossDomainAccessAllowed