Skip to content

Export-Metadata

SYNOPSIS

Creates a metadata file from a simple object

SYNTAX

Export-Metadata [-Path] <Object> [-CommentHeader <String[]>] -InputObject <Object> [-AsHashtable]
 [-Converters <Hashtable>] [-Passthru] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Serves as a wrapper for ConvertTo-Metadata to explicitly support exporting to files

Note that exportable data is limited by the rules of data sections (see about_Data_Sections) and the available MetadataSerializers (see Add-MetadataConverter)

The only things inherently importable in PowerShell metadata files are Strings, Booleans, and Numbers ... and Arrays or Hashtables where the values (and keys) are all strings, booleans, or numbers.

Note: this function and the matching Import-Metadata are extensible, and have included support for PSCustomObject, Guid, Version, etc.

EXAMPLES

EXAMPLE 1

$Configuration | Export-Metadata .\Configuration.psd1

Export a configuration object (or hashtable) to the default Configuration.psd1 file for a module the metadata module uses Configuration.psd1 as it's default config file.

PARAMETERS

-Path

Specifies the path to the PSD1 output file.

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

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

-CommentHeader

comments to place on the top of the file (to explain settings or whatever for people who might edit it by hand)

Type: System.String[]
Parameter Sets: (All)
Aliases:

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

-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: Named
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

-Converters

{{ Fill Converters Description }}

Type: System.Collections.Hashtable
Parameter Sets: (All)
Aliases:

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

-Passthru

If set, output the nuspec file

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

Required: False
Position: Named
Default value: False
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