Skip to content

Export-Configuration

SYNOPSIS

Exports a configuration object to a specified path.

SYNTAX

__ModuleInfo (Default)

Export-Configuration [-InputObject] <Object> [-AsHashtable] [-Module <PSModuleInfo>] [-Version <Version>]
 [-WhatIf] [-Confirm] [<CommonParameters>]

__CallStack

Export-Configuration [-InputObject] <Object> [-AsHashtable] [-CallStack <CallStackFrame[]>]
 [-Version <Version>] [-WhatIf] [-Confirm] [<CommonParameters>]

ManualOverride

Export-Configuration [-InputObject] <Object> [-AsHashtable] -CompanyName <String> -Name <String>
 [-DefaultPath <String>] [-Scope <String>] [-Version <Version>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Exports the configuration object to a file, by default, in the Roaming AppData location

NOTE: this exports the FULL configuration to this file, which will override both defaults and local machine configuration when Import-Configuration is used.

EXAMPLES

EXAMPLE 1

@{UserName = $Env:UserName; LastUpdate = [DateTimeOffset]::Now } | Export-Configuration

This example shows how to use Export-Configuration in your module to cache some data.

EXAMPLE 2

Get-Module Configuration | Export-Configuration @{UserName = $Env:UserName; LastUpdate = [DateTimeOffset]::Now }

This example shows how to use Export-Configuration to export data for use in a specific module.

PSSCriptAnalyzer team refuses to listen to reason. See bugs: #194 #283 #521 #608

PARAMETERS

-InputObject

Specifies the objects to export as metadata structures. Enter a variable that contains the objects or type a command or expression that gets the objects. You can also pipe objects to Export-Metadata.

Type: System.Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-AsHashtable

Serialize objects as hashtables

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-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

DefaultPath is IGNORED. The parameter was here to match Import-Configuration, but it is meaningless in Export-Configuration The only reason I haven't removed it is that I don't want to break any code that might be using it. TODO: If we release a breaking changes Configuration 2.0, remove this parameter

Type: System.String
Parameter Sets: ManualOverride
Aliases: ModuleBase

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Scope

The scope to save at, defaults to Enterprise (which returns a path in "RoamingData")

Type: System.String
Parameter Sets: ManualOverride
Aliases:

Required: False
Position: Named
Default value: Enterprise
Accept pipeline input: False
Accept wildcard characters: False

-Version

The version for saved settings -- if set, will be used in the returned path NOTE: this is NOT calculated from the CallStack

Type: System.Version
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf

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.

INPUTS

OUTPUTS

NOTES

Back to top