Skip to content

Update-Metadata

SYNOPSIS

Update a single value in a PowerShell metadata file

SYNTAX

Overwrite

Update-Metadata [[-Path] <String>] [-PropertyName <String>] -Value <Object> [-WhatIf] [-Confirm]
 [<CommonParameters>]

IncrementVersion

Update-Metadata [[-Path] <String>] [-Increment <String>] [-Passthru] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

By default Update-Metadata increments "ModuleVersion" because my primary use of it is during builds, but you can pass the PropertyName and Value for any key in a module Manifest, its PrivateData, or the PSData in PrivateData.

NOTE: This will not currently create new keys, or uncomment keys.

EXAMPLES

EXAMPLE 1

Update-Metadata .\Configuration.psd1

Increments the Build part of the ModuleVersion in the Configuration.psd1 file

EXAMPLE 2

Update-Metadata .\Configuration.psd1 -Increment Major

Increments the Major version part of the ModuleVersion in the Configuration.psd1 file

EXAMPLE 3

Update-Metadata .\Configuration.psd1 -Value '0.4'

Sets the ModuleVersion in the Configuration.psd1 file to 0.4

EXAMPLE 4

Update-Metadata .\Configuration.psd1 -Property ReleaseNotes -Value 'Add the awesome Update-Metadata function!'

Sets the PrivateData.PSData.ReleaseNotes value in the Configuration.psd1 file!

PARAMETERS

-Path

The path to the module manifest file -- must be a .psd1 file As an easter egg, you can pass the CONTENT of a psd1 file instead, and the modified data will pass through

Type: System.String
Parameter Sets: (All)
Aliases: PSPath

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

-PropertyName

The property to be set in the manifest. It must already exist in the file (and not be commented out) This searches the Manifest root properties, then the properties PrivateData, then the PSData

Type: System.String
Parameter Sets: Overwrite
Aliases:

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

-Value

A new value for the property

Type: System.Object
Parameter Sets: Overwrite
Aliases:

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

-Increment

By default Update-Metadata increments ModuleVersion; this controls which part of the version number is incremented

Type: System.String
Parameter Sets: IncrementVersion
Aliases:

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

-Passthru

When set, and incrementing the ModuleVersion, output the new version number.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: IncrementVersion
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