< Back

Update-Metadata

Sun Jan 12, 2020 6:54 pm

NAME Update-Metadata



SYNOPSIS

Update a single value in a PowerShell metadata file





SYNTAX

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

[<CommonParameters>]



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.





PARAMETERS

-Path <String>

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



Required? false

Position? 1

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-PropertyName <String>

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



Required? false

Position? named

Default value ModuleVersion

Accept pipeline input? false

Accept wildcard characters? false



-Value <Object>

A new value for the property



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Increment <String>

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

incremented



Required? false

Position? named

Default value Build

Accept pipeline input? false

Accept wildcard characters? false



-Passthru [<SwitchParameter>]

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



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:\\>Update-Metadata .\\Configuration.psd1



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









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Update-Metadata .\\Configuration.psd1 -Increment Major



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









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Update-Metadata .\\Configuration.psd1 -Value '0.4'



Sets the ModuleVersion in the Configuration.psd1 file to 0.4









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Update-Metadata .\\Configuration.psd1 -Property ReleaseNotes -Value 'Add the awesome Update-Metadata

function!'



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











RELATED LINKS