< Back
Export-Metadata
Post
NAME 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.
PARAMETERS
-Path <Object>
Specifies the path to the PSD1 output file.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-CommentHeader <String[]>
comments to place on the top of the file (to explain settings or whatever for people who might edit it by hand)
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-InputObject <Object>
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.
Required? true
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-AsHashtable [<SwitchParameter>]
Serialize objects as hashtables
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Converters <Hashtable>
Required? false
Position? named
Default value @{}
Accept pipeline input? false
Accept wildcard characters? false
-Passthru [<SwitchParameter>]
If set, output the nuspec file
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Required? false
Position? named
Default value
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:\\>$Configuration | Export-Metadata .\\Configuration.psd1
Export a configuration object (or hashtable) to the default Configuration.psd1 file for a module
The Configuration module uses Configuration.psd1 as it's default config file.
RELATED LINKS
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.
PARAMETERS
-Path <Object>
Specifies the path to the PSD1 output file.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-CommentHeader <String[]>
comments to place on the top of the file (to explain settings or whatever for people who might edit it by hand)
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-InputObject <Object>
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.
Required? true
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-AsHashtable [<SwitchParameter>]
Serialize objects as hashtables
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Converters <Hashtable>
Required? false
Position? named
Default value @{}
Accept pipeline input? false
Accept wildcard characters? false
-Passthru [<SwitchParameter>]
If set, output the nuspec file
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
Required? false
Position? named
Default value
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:\\>$Configuration | Export-Metadata .\\Configuration.psd1
Export a configuration object (or hashtable) to the default Configuration.psd1 file for a module
The Configuration module uses Configuration.psd1 as it's default config file.
RELATED LINKS