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>]
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.
Specifies an SQL connection string.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
Specifies a database name.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
Performs the action without a confirmation message.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
Specifies the name of a setting.
Aliases |
none |
Required? |
true |
Position? |
2 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
Specifies the namespace of a setting.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
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 |
Specifies a password.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
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 |
Specifies the name of a user account.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
Specifies the value of a setting.
Aliases |
none |
Required? |
false |
Position? |
3 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
Prompts you for confirmation before executing the command.
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
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 |
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters.
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!"