Citrix Virtual Apps and Desktops 2402 SDK

New-XDDatabase

Creates the specified Database or all Databases.

Syntax

New-XDDatabase
   [-AllDefaultDatabases]
   [-DatabaseCredentials <PSCredential>]
   [-DatabaseNamePrefix <String>]
   -DatabaseServer <String>
   -SiteName <String>
   [-AdminAddress <String>]
   [<CommonParameters>]
<!--NeedCopy-->
New-XDDatabase
   [-DatabaseCredentials <PSCredential>]
   [-DatabaseName <String>]
   -DatabaseServer <String>
   -DataStore <DataStore>
   -SiteName <String>
   [-AdminAddress <String>]
   [<CommonParameters>]
<!--NeedCopy-->

Description

If AllDefaultDatabases is specified, this cmdlet creates all databases using their default names on the specified SQL server. When used in this manner, the cmdlet need only be called once.

If DataStore is specified, this cmdlet creates the specified database on the specified SQL Server. When used in this manner, the cmdlet should be called once per datastore.

This cmdlet creates, but does not configure, the Database. Run New-XDSite to configure the Site to use the Database.

For database mirroring please refer to “about_XenDesktopModule_SiteConfiguration”.

Examples

EXAMPLE 1

Creates a Site Configuration Database called ‘MySiteDatabase’ for the Site named ‘MySite’ on ‘Instance_1’ of the SQL Server ‘MySqlServer’.

New-XDDatabase -AdminAddress MySiteController -SiteName MySite -Datastore Site -DatabaseServer MySqlServer\Instance_1 -DatabaseName MySiteDatabase
<!--NeedCopy-->

EXAMPLE 2

Creates a Configuration Logging Database called ‘MyLoggingDatabase’ for the Site named ‘MySite’ on ‘Instance_1’ of the SQL Server ‘MySqlServer’.

New-XDDatabase -AdminAddress MySiteController -SiteName MySite -Datastore Logging -DatabaseServer MySqlServer\Instance_1 -DatabaseName MyLoggingDatabase
<!--NeedCopy-->

EXAMPLE 3

Creates a Monitoring Database called ‘MyMonitorDatabase’ for the Site named ‘MySite’ on ‘Instance_1’ of the SQL Server ‘MySqlServer’.

New-XDDatabase -AdminAddress MySiteController -SiteName MySite -Datastore Monitor -DatabaseServer MySqlServer\Instance_1 -DatabaseName MyMonitorDatabase
<!--NeedCopy-->

EXAMPLE 4

Creates Site Configuration, Configuration Logging and Monitoring Databases called ‘MyPrefix-CitrixMySite’, ‘MyPrefix-CitrixConfigLoggingMySite’ and ‘MyPrefix-CitrixMonitorMySite’ for the Site named ‘MySite’ on ‘Instance_1’ of the SQL Server ‘MySqlServer’.

New-XDDatabase -AdminAddress MySiteController -SiteName MySite -AllDefaultDatabases -DatabaseServer MySqlServer\Instance_1 -DatabaseNamePrefix  MyPrefix-
<!--NeedCopy-->

Parameters

-AllDefaultDatabases

All databases are created with their default names. The default names are listed with their corresponding dataStore types as follows:

  • Site

The Site Configuration Database. The default name of this database is Citrix<SiteName>.

  • Logging

The Configuration Logging Database. The default name of this database is CitrixConfigLogging<SiteName>.

  • Monitor

The Monitoring Database. The default name of this database is CitrixMonitor<SiteName>.

Type: SwitchParameter
Position: Named
Default value: None
Required: True
Accept pipeline input: False
Accept wildcard characters: False

-DatabaseServer

The address of the SQL Server in which the database is to be created. This must include the SQL Instance name.

Type: String
Position: Named
Default value: None
Required: True
Accept pipeline input: False
Accept wildcard characters: False

-SiteName

The name of the Site for which the specified database is to be created.

Type: String
Position: Named
Default value: None
Required: True
Accept pipeline input: False
Accept wildcard characters: False

-DataStore

The datastore type that is to be created. Valid values are Site, Logging and Monitor.

Type: DataStore
Position: Named
Default value: None
Required: True
Accept pipeline input: False
Accept wildcard characters: False

-DatabaseCredentials

The security credentials, in the form of a PSCredential object, that will be used to connect to the SQL Server specified by the DatabaseServer parameter. If this parameter is not provided, then the implicit credentials of the user running the cmdlet are used to connect to the SQL Server.

Type: PSCredential
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-DatabaseNamePrefix

The prefix to be added to the default database names when AllDefaultDatabases is specified.

Type: String
Position: Named
Default value: None
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-DatabaseName

The name that should be used for the database of the specified datastore type.

Type: String
Position: Named
Default value: Site = Citrix, Logging = CitrixConfigLogging and Monitor = CitrixMonitor
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-AdminAddress

Specifies the address of the Delivery Controller to which the PowerShell module will connect. This can be provided as a host name or an IP address.

Type: String
Position: Named
Default value: Localhost. Once a value is provided by any cmdlet, this value will become the default.
Required: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

None

You cannot pipe input into this cmdlet.

Outputs

Citrix.XenDesktopPowerShellSdk.ServiceInterfaces.Configuration.Database

One Database object is returned for each datastore type that is created. Each Database object includes the database name, datastore type and SQL Server address.

Notes

If the user running this cmdlet does not have privilege to create databases on the specified SQL Server, then alternative credentials may be provided using the DatabaseCredentials parameter.

The command can fail for the following reasons:

  • A connection could not be established with the specified SQL Server.
  • The person running the cmdlet, or the supplied credentials, do not have sufficient privilege to create databases on the specified SQL Server. In this situation, use Get-XDDatabaseSchema, instead of New-XDDatabase, to generate SQL database creation scripts that may be given to a database administrator for execution on the SQL Server.
New-XDDatabase