Product Documentation

Get-BrokerDBSchema

Oct 12, 2015

Gets SQL scripts to create or maintain the database schema for the Citrix Broker Service.

Syntax

Get-BrokerDBSchema -DatabaseName <String> [-ServiceGroupName <String>] [-ScriptType <DatabaseScriptType>] [-SID <String>] [-LocalDatabase] [-AdminAddress <String>] [<CommonParameters>]

Detailed Description

Gets SQL scripts that can be used to create a new Citrix Broker Service database schema, add a new broker service to an existing site, remove a broker service from a site, or create a database server logon for a broker service.

If no Sid parameter is provided, the scripts obtained relate to the currently selected broker service instance, otherwise the scripts relate to broker service instance running on the machine identified by the Sid provided. When obtaining the Evict script, a Sid parameter must be supplied.

The current service instance is that on the local machine, or that explicitly specified by the last usage of the -AdminAddress parameter to a Broker SDK cmdlet.

The service instance used to obtain the scripts does not need to be a member of a site or to have had its database connection configured.

The database scripts support only Microsoft SQL Server, or SQL Server Express, and require Windows integrated authentication to be used. They can be run using SQL Server's SQLCMD utility, or by copying the script into an SQL Server Management Studio (SSMS) query window and executing the query. If using SSMS, the query must be executed in 'SQLCMD mode'.

The ScriptType parameter determines what script is obtained. If ScriptType is not specified, or is FullDatabase, the script contains:

o Creation of service schema

o Creation of database server logon

o Creation of database user

o Addition of database user to broker service roles

If ScriptType is Instance, the returned script contains:

o Creation of database server logon

o Creation of database user

o Addition of database user to broker service roles

If ScriptType is Evict, the returned script contains:

o Removal of broker service instance from database

o Removal of database user

If ScriptType is Login, the returned script contains:

o Creation of database server logon only

Parameters

-DatabaseName<String>

Specifies the name of the database into which the new broker service schema is to be placed, or in which it already exists. The database itself is not created by any of the script types; it must already exist before the scripts are run.

Required? true
Default Value  
Accept Pipeline Input? false

-ServiceGroupName<String>

The name of the service group to be used when creating the Citrix Broker Service database schema. The service group is the collection of all broker services that share the same database and are considered equal (i.e. any service in the same service group can be used interchangeably).

Required? false
Default Value  
Accept Pipeline Input? false

-ScriptType<DatabaseScriptType>

Specifies the type of database script to be returned. The different script types are as follows:

-- FullDatabase

Creates a database schema for the Citrix Broker Service in a database instance that does not already contain one. This is used when creating a new site. DatabaseName and ServiceGroupName are required parameters for this script type.

-- Instance

Adds a broker service instance to a database and so to the associated site. Appropriate database server logons and users are created to allow the service instance access to the required service schemas.

-- Evict

Removes a broker service instance from the database and so from the site. All reference to the service instance is removed from the database. DatabaseName and Sid are required parameters for this script type.

-- Login

Adds a logon for the broker service instance to a database server. This is specifically for use when configuring SQL Server mirroring where the mirror server must have appropriate logons created for all service instances in the site.

Required? false
Default Value  
Accept Pipeline Input? false

-SID<String>

Specifies the SID of the controller on which the broker service instance to remove from the database is running (only valid for a script type of Evict).

Required? false
Default Value None
Accept Pipeline Input? false

-LocalDatabase<SwitchParameter>

Indicates that the database server is running on the same machine as the service instance itself. If this parameter is specified inappropriately, the service instance will not be able to connect to the database.

Required? false
Default Value  
Accept Pipeline Input? false

-AdminAddress<String>

Specifies the address of a XenDesktop controller that the PowerShell snapin will connect to. This can be provided as a host name or an IP address.

Required? false
Default Value Localhost. Once a value is provided by any cmdlet, this value will become the default.
Accept Pipeline Input? false

Input Type

None You cannot pipe input into this cmdlet.

Return Values

System.String

A string containing the required SQL script for applying to a database.

Examples

-------------------------- EXAMPLE 1 --------------------------

C:\PS>Get-BrokerDBSchema -DatabaseName MySiteDB -ServiceGroupName  MyServiceGroup > C:\BrokerSchema.sql

Gets a script to create the full database schema for the Citrix Broker Service and copies it to a file called "C:\BrokerSchema.sql"

This script can be used to create the service schema in a database with name "MySiteDB", which must already exist, and must not already contain a broker service schema.

-------------------------- EXAMPLE 2 --------------------------

C:\PS>Get-BrokerDBSchema -DatabaseName MySiteDB -ScriptType Login > C:\BrokerLogins.sql

Gets a script to create the appropriate database server logon for the broker service. This can be used when configuring a mirror server for use.