< Back

Import-PSFConfig

Sun Jan 19, 2020 6:41 pm

NAME Import-PSFConfig



SYNOPSIS

Imports a json configuration file into the configuration system.





SYNTAX

Import-PSFConfig -Path <String[]> [-Schema <String>] [-IncludeFilter <String[]>] [-ExcludeFilter <String[]>]

[-Peek] [-AllowDelete] [-PassThru] [-EnableException] [<CommonParameters>]



Import-PSFConfig -ModuleName <String> [-ModuleVersion <Int32>] [-Scope {UserDefault | UserMandatory |

SystemDefault | SystemMandatory | FileUserLocal | FileUserShared | FileSystem}] [-PassThru] [-EnableException]

[<CommonParameters>]





DESCRIPTION

Imports a json configuration file into the configuration system.





PARAMETERS

-Path <String[]>

The path to the json file to import.



Required? true

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-ModuleName <String>

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



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ModuleVersion <Int32>

The configuration version of the module-settings to load.



Required? false

Position? named

Default value 1

Accept pipeline input? false

Accept wildcard characters? false



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



Required? false

Position? named

Default value FileUserLocal, FileUserShared, FileSystem

Accept pipeline input? false

Accept wildcard characters? false



-Schema <String>

The configuration schema to use for import.

Use Register-PSFConfigSchema to extend the way input content can be laid out.



Required? false

Position? named

Default value Default

Accept pipeline input? false

Accept wildcard characters? false



-IncludeFilter <String[]>

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



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ExcludeFilter <String[]>

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



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Peek [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-AllowDelete [<SwitchParameter>]

Configurations that have been imported will be flagged as deletable.

This allows to purge them at a later time using Remove-PSFConfig.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-PassThru [<SwitchParameter>]

Return configuration settings that have been imported.

By default, this command will not produce any output.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-EnableException [<SwitchParameter>]

This parameters disables user-friendly warnings and enables the throwing of exceptions.

This is less user friendly, but allows catching exceptions in calling scripts.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Import-PSFConfig -Path '.\\config.json'



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









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Import-PSFConfig -ModuleName mymodule



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











RELATED LINKS