Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Publish-Module

Publish-Module

psget.psm1, psget-2.psm1

Synopsis

Publishes a specified module from the local computer to an online gallery.

Syntax

Publish-Module [-IconUri] [-LicenseUri] [-ProjectUri] [-ReleaseNotes] [-Repository] [-Tags] [-Name] [-NuGetApiKey] [-Confirm] [-WhatIf] [<CommonParameters>]

Publish-Module [-IconUri] [-LicenseUri] [-ProjectUri] [-ReleaseNotes] [-Repository] [-Tags] [-NuGetApiKey] [-Path] [-Confirm] [-WhatIf] [<CommonParameters>]

Detailed Description

Publish-Module publishes a module to an online NuGet-based gallery by using an API key, stored as part of a user’s profile in the gallery. You can specify the module to publish either by the module’s name, or by the path to the folder containing the module.

When you specify a module by name, Publish-Module publishes the first module that would be found by running Get-Module -ListAvailable <Name>. If you specify a minimum version of a module to publish, Publish-Module publishes the first module with a version that is greater than or equal to the minimum version that you have specified.

Publishing a module requires metadata that is displayed on the gallery page for the module. Required metadata includes the module name, version, description, and author. Although most metadata is taken from the module manifest, some metadata must be specified in Publish-Module parameters, such as Tag, ReleaseNote, IconUri, ProjectUri, and LicenseUri, because these parameters match fields in a NuGet-based gallery.

Parameters

-IconUri <Uri>

Specifies the URL of an icon for the module. The specified icon is displayed on the gallery webpage for the module.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-LicenseUri <Uri>

Specifies the URL of licensing terms for the module you want to publish.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Name <String>

Specifies the name of the module that you want to publish. Publish-Module searches for the specified module name in $Env:PSModulePath.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-NuGetApiKey <String>

Specifies the API key that you want to use to publish a module to the online gallery. The API key is part of your profile in the online gallery, and can be found on your user account page in the gallery. The API key is NuGet-specific functionality.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Path <String>

Specifies the path to the module that you want to publish. This parameter accepts either the path to the folder that contains the module, or the module manifest (.psd1) file. The parameter accepts piped values from Get-Module.

Aliases

None

Required?

true

Position

named

Default value

None

Accept pipeline input?

True (ByPropertyName)

Accept wildcard characters?

false

-ProjectUri <Uri>

Specifies the URL of a webpage about this project.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-ReleaseNotes <String>

Specifies a string containing release notes or comments that you want to be available to users of this version of the module.

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Repository <String>

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Tags <String[]>

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Confirm <SwitchParameter>

Prompts you for confirmation before running the cmdlet.

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

-WhatIf <SwitchParameter>

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

Aliases

None

Required?

false

Position

named

Default value

false

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type


Return Type


Notes

This cmdlet runs on Windows PowerShell 3.0 or later releases of Windows PowerShell, on Windows 7 or Windows 2008 R2 and later releases of Windows.

Publish-Module shows no output if a module is published successfully.

Examples

-------------------------- EXAMPLE 1 --------------------------

In this example, MyDscModule is published to the online gallery by using the API key to indicate the module owner’s online gallery account. If MyDscModule is not a valid manifest module that specifies a name, version, description, and author, an error occurs.

PS C:\>Publish-Module -Name MyDscModule -NuGetApiKey "11e4b435-6cb4-4bf7-8611-5162ed75eb73"

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

In this example, MyDscModule is published to the online gallery by using the API key to indicate the module owner’s gallery account. The additional metadata provided is displayed on the webpage for the module in the gallery. The owner adds two search tags for the module, relating it to Active Directory; a brief release note is also added. If MyDscModule is not a valid manifest module that specifies a name, version, description, and author, an error occurs.

PS C:\>Publish-Module -Name MyDscModule -NuGetApiKey "11e4b435-6cb4-4bf7-8611-5162ed75eb73" -LicenseUri "http://contoso.com/license" -Tag "Active Directory","DSC" -ReleaseNote "Updated the ActiveDirectory DSC Resources to support adding users."

Online Version