commands

^

Import-DbatoolsConfig

Author Friedrich Weinmann (@FredWeinmann)
Availability Windows, Linux, macOS

 

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

Synopsis

Imports a json configuration file into the configuration system.

Description

Imports a json configuration file into the configuration system.

Syntax

Import-DbatoolsConfig -Path <String[]>
    [-IncludeFilter <String[]>]
    [-ExcludeFilter <String[]>]
    [-Peek]
    [-EnableException]
    [<CommonParameters>]

Import-DbatoolsConfig -ModuleName <String>
    [-ModuleVersion <Int32>]
    [-Scope {UserDefault | UserMandatory | SystemDefault | SystemMandatory | FileUserLocal | FileUserShared | FileSystem}]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Import-DbatoolsConfig -Path '.\config.json'

Imports the configuration stored in '.\config.json'

Example: 2
PS C:\> Import-DbatoolsConfig -ModuleName message

Imports all the module specific settings that have been persisted in any of the default file system paths.

Required Parameters

-Path

The path to the json file to import.

Alias
Required True
Pipeline true (ByValue)
Default Value
-ModuleName

Import configuration items specific to a module from the default configuration paths.

Alias
Required True
Pipeline false
Default Value

Optional Parameters

-ModuleVersion

The configuration version of the module-settings to load.

Alias
Required False
Pipeline false
Default Value 1
-Scope

Where to import the module specific configuration items form.
Only file-based scopes are supported for this.
By default, all locations are queried, with user settings beating system settings.

Alias
Required False
Pipeline false
Default Value FileUserLocal, FileUserShared, FileSystem
-IncludeFilter

If specified, only elements with names that are similar (-like) to names in this list will be imported.

Alias
Required False
Pipeline false
Default Value
-ExcludeFilter

Elements that are similar (-like) to names in this list will not be imported.

Alias
Required False
Pipeline false
Default Value
-Peek

Rather than applying the setting, return the configuration items that would have been applied.

Alias
Required False
Pipeline false
Default Value False
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

Alias
Required False
Pipeline false
Default Value False