New-SPAccessServicesDatabaseServer
Published: July 16, 2012
Applies to: SharePoint Server 2013 Enterprise
Adds a new SQL Server database to the list of servers.
New-SPAccessServicesDatabaseServer [-ServiceContext] <SPServiceContextPipeBind> -DatabaseServerName <String> [-AssignmentCollection <SPAssignmentCollection>] [-AvailableForCreate <$true | $false>] [-Confirm [<SwitchParameter>]] [-DatabaseServerCredentials <PSCredential>] [-DatabaseServerGroupName <String>] [-Encrypt <$true | $false>] [-Exclusive <SwitchParameter>] [-ServerReferenceId <Guid>] [-WhatIf [<SwitchParameter>]]
Parameters
| Parameter | Required | Type | Description | ||
|---|---|---|---|---|---|
| ServiceContext | Required | Microsoft.SharePoint.PowerShell.SPServiceContextPipeBind | Specifies the service context to create the Access Services database server. | ||
| DatabaseServerName | Required | System.String | Specifies the name of the server running SQL Server that you choose to host the new Access Services application databases. | ||
| AssignmentCollection | Optional | Microsoft.SharePoint.PowerShell.SPAssignmentCollection | Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.
| ||
| AvailableForCreate | Optional | System.Boolean | Specifies whether the new server should be available for new database creation. The default value is True. Setting the value to True will set all other servers in the list to False. | ||
| Confirm | Optional | System.Management.Automation.SwitchParameter | Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters | ||
| DatabaseServerCredentials | Optional | System.Management.Automation.PSCredential | Specifies the Credential object for the database user. Use this parameter if you use SQL Server Authentication. If no database credentials are provided, Windows authentication is used. | ||
| DatabaseServerGroupName | Optional | System.String | Specifies the Access Services database server group name. | ||
| Encrypt | Optional | System.Boolean | Specifies all connections to the database server will use Secure Sockets Layer (SSL) if the database supports it. | ||
| Exclusive | Optional | System.Management.Automation.SwitchParameter | Enables the AvailableForCreate flag for this server and disables it for all other servers in the DatabaseServerGroup. | ||
| ServerReferenceId | Optional | System.Guid | A unique identifier for the database server. Used for maintaining continuity when restoring an existing content database to a different or new farm. | ||
| WhatIf | Optional | System.Management.Automation.SwitchParameter | Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters |
Detailed Description
Use the New-SPAccessServicesDatabaseServer cmdlet to add a new SQL Server database to the list of servers for application databases.
If you use the New-SPAccessServicesDatabaseServer cmdlet does in hosted mode, you receive the following error message:
This operation is not supported when Access Services is running in hosted mode.
If the SQL Authentication method is selected for the database credentials, the method checks that the Secure Store service is running and is accessible to the service. If the Secure Store service is unable to connect, the following message is displayed:
Operation failed. Secure Store Service must be running and accessible to the service in order to use SQL Authentication credentials.
Input Types
Return Types
--------------EXAMPLE---------
$serverGroupName = 'DEFAULT'
$farm = Get-SPFarm;
$account = $($farm.DefaultServiceAccount.Name);
$serviceAppName = "Access Services"
$onPremAppPool = "on-prem-pool"
$identity = Get-SPServiceApplication -Name $serviceAppName
$acct = Get-SPManagedAccount -Identity $account
$ApplicationPool = Get-spserviceapplicationpool –Identity $onPremAppPool
if($ApplicationPool -eq $NULL)
{
$ApplicationPool = new-spserviceapplicationpool –name $onPremAppPool –account $acct
}
New-SPAccessServicesApplication -Name $serviceAppName -ApplicationPool $ApplicationPool -Default
$ASapp = Get-SPAccessServicesApplication
$app = $Null
if ($ASapp.length -ne $Null) { $app = $ASapp[0] } else { $app = $ASapp }
$context = [Microsoft.SharePoint.SPServiceContext]::GetContext($app.ServiceApplicationProxyGroup, [Microsoft.SharePoint.SPSiteSubscriptionIdentifier]::Default)
$newdbserver = New-SPAccessServicesDatabaseServer -ServiceContext $context -DatabaseServerName $sqlServerName -DatabaseServerGroup $serverGroupName -AvailableForCreate $true
This example creates a new Access Services database server.
Change History
| Date | Description |
|---|---|
| July 16, 2012 | Initial publication |

Note: