Set-MgmtSvcDatabaseSetting

Writes settings to the configuration database.

Syntax

Set-MgmtSvcDatabaseSetting
   [-Namespace] <String>
   [-Name] <String>
   [[-Value] <String>]
   [-Force]
   [-Passphrase <String>]
   [-Database <String>]
   [-Server <String>]
   [-UserName <String>]
   [-Password <String>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-MgmtSvcDatabaseSetting
   [-Namespace] <String>
   [-Name] <String>
   [[-Value] <String>]
   [-Force]
   [-Passphrase <String>]
   [-ConnectionString <String>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Set-MgmtSvcDatabaseSetting cmdlet writes configuration settings for a management service component to the database. A setting consists of a namespace, a name, and a value.

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: Write a setting to the database

PS C:\> $MK = New-MgmtSvcMachineKey
PS C:\> $ConnectionString = 'Data Source=mysqlserver;Initial Catalog=Microsoft.MgmtSvc.Config;User ID=sa;Password=Book67pp'
PS C:\> Set-MgmtSvcDatabaseSetting -ConnectionString $ConnectionString -Namespace "TenantSite" -Name "machineKey.decryptionKey" -Value $MK.Attributes(""decryptionKey"").Value -Force -Passphrase "PassPhrase01!"

The first command creates a machine key by using the New-MgmtSvcMachineKey cmdlet, and stores it in the $MK variable.

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

The last command writes the namespace, name, and value to the database. The command uses the connection string stored in $ConnectionString and the machine key stored in $MK. The command also includes a passphrase.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-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.

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

-Force

Performs the action without a confirmation message.

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

-Name

Specifies the name of a setting.

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

-Namespace

Specifies the namespace of a setting.

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

-Passphrase

Specifies a passphrase. The database encrypts items in the configuration store by using this passphrase.

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

-Password

Specifies a password.

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.

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

-Value

Specifies the value of a setting.

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