commands

^

Register-DbatoolsConfig

Author Chrissy LeMaire (@cl), netnerds.net
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Register-DbatoolsConfig on GitHub.
Want to see the Bill Of Health for this command? Check out Register-DbatoolsConfig.

Synopsis

Registers an existing configuration object in registry.

Description

Registers an existing configuration object in registry. This allows simple persisting of settings across powershell consoles. It also can be used to generate a registry template, which can then be used to create policies.

Syntax

Register-DbatoolsConfig
    [-Config <Config[]>]
    [-FullName <String[]>]
    [-Scope {UserDefault | UserMandatory | SystemDefault | SystemMandatory | FileUserLocal | FileUserShared | FileSystem}]
    [-EnableException]
    [<CommonParameters>]

Register-DbatoolsConfig
    [-Module] <String>
    [[-Name] <String>]
    [-Scope {UserDefault | UserMandatory | SystemDefault | SystemMandatory | FileUserLocal | FileUserShared | FileSystem}]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Get-DbatoolsConfig message.style.* | Register-DbatoolsConfig

Retrieves all configuration items that that start with message.style. and registers them in registry for the current user.

Example: 2
PS C:\> Register-DbatoolsConfig -FullName "message.consoleoutput.disable" -Scope SystemDefault

Retrieves the configuration item "message.consoleoutput.disable" and registers it in registry as the default setting for all users on this machine.

Example: 3
PS C:\> Register-DbatoolsConfig -Module Message -Scope SystemMandatory

Retrieves all configuration items of the module Message, then registers them in registry to enforce them for all users on the current system.

Example: 4
PS C:\> Set-DbatoolsConfig -FullName sql.connection.trustcert -Value $true -PassThru | Register-DbatoolsConfig

Set the "sql.connection.trustcert" configuration to be $true, and then use the -PassThru parameter
to be able to pipe the output and register them in registry for the current user.

Required Parameters

-Module

The name of the module, whose settings should be written to registry.

Alias
Required True
Pipeline false
Default Value

Optional Parameters

-Config

The configuration object to write to registry. Can be retrieved using Get-DbatoolsConfig.

Alias
Required False
Pipeline true (ByValue)
Default Value
-FullName

The full name of the setting to be written to registry.

Alias
Required False
Pipeline true (ByValue)
Default Value
-Name

Default: "*" Used in conjunction with the -Module parameter to restrict the number of configuration items written to registry.

Alias
Required False
Pipeline false
Default Value *
-Scope

Default: UserDefault Who will be affected by this export how? Current user or all? Default setting or enforced? Legal values: UserDefault, UserMandatory, SystemDefault, SystemMandatory

Alias
Required False
Pipeline false
Default Value UserDefault
-EnableException

This parameters disables user-friendly warnings and enables the throwing of exceptions. This is less user friendly, but allows catching exceptions in calling scripts.

Alias
Required False
Pipeline false
Default Value False