Get-MgmtSvcDatabaseSetting

Reads settings from a configuration database.

Syntax

Get-MgmtSvcDatabaseSetting
   [[-Namespace] <String[]>]
   [[-Name] <String[]>]
   [-Passphrase <String>]
   [-Database <String>]
   [-Server <String>]
   [-UserName <String>]
   [-Password <String>]
   [<CommonParameters>]
Get-MgmtSvcDatabaseSetting
   [[-Namespace] <String[]>]
   [[-Name] <String[]>]
   [-Passphrase <String>]
   [-ConnectionString <String>]
   [<CommonParameters>]

Description

The Get-MgmtSvcDatabaseSetting cmdlet reads the configuration settings of a management service component from the database. A setting consists of a namespace, a name, and a value. If you protected a setting by encrypting it, you need to supply a value for the Passphrase parameter to decrypt the setting.

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.

Examples

Example 1: Get a setting

PS C:\> $ConnectionString = 'Data Source=rd-source04;Initial Catalog=Microsoft.MgmtSvc.Config;User ID=SA;Password=PassWord01'
PS C:\> Get-MgmtSvcDatabaseSetting -Namespace "TenantSite" -Name "machineKey.decryptionKey" -ConnectionString $ConnectionString -Passphrase "PassPhrase01"

The first command stores a connection string in the $ConnectionString variable.

The second command gets the setting that has the specified namespace, name, and value. A passphrase is supplied to decrypt the setting.

Parameters

-ConnectionString

Specifies an SQL connection string.

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

-Database

Specifies a database name. The Config schema must be in stalled in this database.

By default, the Config schema is installed in the following databases:

  • Microsoft.MgmtSvc.Config
  • Microsoft.MgmtSvc.PortalConfigStore
  • Microsoft.MgmtSvc.Store
Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Specifies an array of names for a setting.

Type:String[]
Position:1
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Namespace

Specifies an array of namespaces for a setting.

Type:String[]
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Passphrase

Specifies a passphrase. If a setting was previously encrypted, provide a passphrase to decrypt the setting. A passphrase must be provided if the setting requires it.

By default, only Microsoft.MgmtSvc.Config settings require a passphrase.

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

-Password

Specifies a password for the user to connect to the database.

Type:String
Position:Named
Default value:None
Required:False
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UserName

Specifies the name of a user account used to connect to the database.

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