commands

^

Export-DbatoolsConfig

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

 

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

Synopsis

Exports configuration items to a Json file.

Description

Exports configuration items to a Json file.

Syntax

Export-DbatoolsConfig -FullName <String>
    [-OutPath] <String>
    [-SkipUnchanged]
    [-EnableException]
    [<CommonParameters>]

Export-DbatoolsConfig -Module <String>
    [[-Name] <String>]
    [-OutPath] <String>
    [-SkipUnchanged]
    [-EnableException]
    [<CommonParameters>]

Export-DbatoolsConfig -Config <Config[]>
    [-OutPath] <String>
    [-SkipUnchanged]
    [-EnableException]
    [<CommonParameters>]

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

 

Examples

 

Example: 1
PS C:\> Get-DbatoolsConfig | Export-DbatoolsConfig -OutPath '~/export.json'

Exports all current settings to json.

Example: 2
PS C:\> Export-DbatoolsConfig -Module message -OutPath '~/export.json' -SkipUnchanged

Exports all settings of the module 'message' that are no longer the original default values to json.

Required Parameters

-FullName

Select the configuration objects to export by filtering by their full name.

Alias
Required True
Pipeline false
Default Value
-Module

Select the configuration objects to export by filtering by their module name.

Alias
Required True
Pipeline false
Default Value
-Config

The configuration object(s) to export.
Returned by Get-DbatoolsConfig.

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

Exports all configuration pertinent to a module to a predefined path.
Exported configuration items include all settings marked as 'ModuleExport' that have been changed from the default value.

Alias
Required True
Pipeline false
Default Value
-OutPath

The path (filename included) to export to.
Will fail if the folder does not exist, will overwrite the file if it exists.

Alias
Required True
Pipeline false
Default Value

Optional Parameters

-Name

Select the configuration objects to export by filtering by their name.

Alias
Required False
Pipeline false
Default Value *
-ModuleVersion

The configuration version of the module-settings to write.

Alias
Required False
Pipeline false
Default Value 1
-Scope

Which predefined path to write module specific settings to.
Only file scopes are considered.
By default it writes to the suer profile.

Alias
Required False
Pipeline false
Default Value FileUserShared
-SkipUnchanged

If set, configuration objects whose value was not changed from its original value will not be exported.
(Note: Settings that were updated with the same value as the original default will still be considered changed)

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