Import-Configuration
SYNOPSIS
Import the full, layered configuration for the module.
SYNTAX
__CallStack (Default)
Import-Configuration [-CallStack <CallStackFrame[]>] [-Version <Version>] [-Ordered]
[-AllowedVariables <String[]>] [<CommonParameters>]
__ModuleInfo
Import-Configuration [-Module <PSModuleInfo>] [-Version <Version>] [-Ordered] [-AllowedVariables <String[]>]
[<CommonParameters>]
ManualOverride
Import-Configuration -CompanyName <String> -Name <String> [-DefaultPath <String>] [-Version <Version>]
[-Ordered] [-AllowedVariables <String[]>] [<CommonParameters>]
DESCRIPTION
Imports the DefaultPath Configuration file, and then imports the Machine, Roaming (enterprise), and local config files, if they exist. Each configuration file is layered on top of the one before (so only needs to set values which are different)
EXAMPLES
EXAMPLE 1
$Configuration = Import-Configuration
This example shows how to use Import-Configuration in your module to load the cached data
EXAMPLE 2
$Configuration = Get-Module Configuration | Import-Configuration
This example shows how to use Import-Configuration in your module to load data cached for another module
PARAMETERS
-CallStack
A callstack. You should not ever pass this. It is used to calculate the defaults for all the other parameters.
Type: System.Management.Automation.CallStackFrame[]
Parameter Sets: __CallStack
Aliases:
Required: False
Position: Named
Default value: $(Get-PSCallStack)
Accept pipeline input: False
Accept wildcard characters: False
-Module
The Module you're importing configuration for
Type: System.Management.Automation.PSModuleInfo
Parameter Sets: __ModuleInfo
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
-CompanyName
An optional module qualifier (by default, this is blank)
Type: System.String
Parameter Sets: ManualOverride
Aliases: Author
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Name
The name of the module or script Will be used in the returned storage path
Type: System.String
Parameter Sets: ManualOverride
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-DefaultPath
The full path (including file name) of a default Configuration.psd1 file By default, this is expected to be in the same folder as your module manifest, or adjacent to your script file
Type: System.String
Parameter Sets: ManualOverride
Aliases: ModuleBase
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Version
The version for saved settings -- if set, will be used in the returned path NOTE: this is never calculated, if you use version numbers, you must manage them on your own
Type: System.Version
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Ordered
If set (and PowerShell version 4 or later) preserve the file order of configuration This results in the output being an OrderedDictionary instead of Hashtable
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-AllowedVariables
Allows extending the valid variables which are allowed to be referenced in configuration BEWARE: This exposes the value of these variables in the calling context to the configuration file You are reponsible to only allow variables which you know are safe to share
Type: System.String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.