Install-MgmtSvcDatabase

Creates a schema and database objects in a database.

Syntax

Install-MgmtSvcDatabase
       -Schema <String>
       [-ConnectionString <String>]
       [-Server <String>]
       [-Database <String>]
       [-UserName <String>]
       [-Password <String>]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]

Description

The Install-MgmtSvcDatabase cmdlet creates schema and associated database objects. The cmdlet creates the database if it does not already exist. The cmdlet installs a database schema on the specific server from scripts consumed during portal installation.

You can run this cmdlet from any computer in the deployment. However, this cmdlet assumes that the database is on the local computer. If the database is on another computer, you must use the Server, UserName, Password, and Database parameters, or a SQL connection string. If you specify a connection string by using the ConnectionString parameter, that value takes precedence over the Server, UserName, Password, and Database parameters.

You can run this cmdlet repeatedly on the existing database without destroying data. You can specify a new or an existing database, and, depending on the schemas, you can install multiple schemas in the same database.

The Initialize-MgmtSvcFeature cmdlet calls this cmdlet to configure the required databases.

After importing the latest commands (Import-Module -Name MgmtSvcConfig), you can run Install-MgmtSvcDatabase to upgrade specific database schemas (specified by the schema parameter). For example: Install-MgmtSvcDatabase -Schema SqlServer -Server "$env:ComputerName" -UserName "sysadmin_login" -Password "sysadmin_password".

Once you do this, you'll be using the latest version of the installation database, which provides bug fixes and support for new features. For example, using Windows Authentication when creating databases in SQL Server, only works after you've upgraded your database schema. Since the installer can't upgrade your database automatically, you must manually run the upgrade script and provide system administrator credentials to the SQL Server that hosts your management databases (UserName and Password).

For your installation to support all features of the latest release, you must perform appropriate backups and manually upgrade you installation by running the following:

Import-Module -Name MgmtSvcConfig ; Install-MgmtSvcDatabase -Schema SqlServer -Server "$env:ComputerName" -UserName "sysadmin_login" -Password "sysadmin_password"

Examples

Example 1: Add a schema to the database

PS C:\> Install-MgmtSvcDatabase -Schema "Management" -ConnectionString ""Data Source=$env:ComputerName;Initial Catalog=Management;Integrated Security=SSPI""

This command adds the schema Management to the database.

Required Parameters

-Schema

Specifies a schema. The cmdlet installs this schema.

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

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-ConnectionString

Specifies an SQL connection string.

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

Specifies a database name.

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

Specifies a password.

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

Specifies the name of the computer on which the SQL database resides.

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

Specifies the name of a user account.

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

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False