Set-MgmtSvcDatabaseSetting

Set-MgmtSvcDatabaseSetting

Writes settings to the configuration database.

Syntax

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


 

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

Parameters

-ConnectionString<String>

Specifies an SQL connection string.

 

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

 

-Database<String>

Specifies a database name.

 

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

 

-Force

Performs the action without a confirmation message.

 

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

 

-Name<String>

Specifies the name of a setting.

 

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

 

-Namespace<String>

Specifies the namespace of a setting.

 

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

 

-Passphrase<String>

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

 

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

 

-Password<String>

Specifies a password.

 

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

 

-Server<String>

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

 

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

 

-UserName<String>

Specifies the name of a user account.

 

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

 

-Value<String>

Specifies the value of a setting.

 

Aliases

none

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

 

-Confirm

Prompts you for confirmation before executing the command.

 

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

 

-WhatIf

Describes what would happen if you executed the command without actually executing the command.

 

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

 

<CommonParameters>

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

Examples

Example 1: Write a setting to the database

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.

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!"

 

Related topics

Get-MgmtSvcDatabaseSetting

Test-MgmtSvcPassphrase

Reset-MgmtSvcPassphrase

New-MgmtSvcMachineKey