Publish-PSResource
Publishes a specified module from the local computer to PSResource repository.
Syntax
Publish-PSResource
[-ApiKey <String>]
[-Repository <String>]
[-Path] <String>
[-DestinationPath <String>]
[-Credential <PSCredential>]
[-SkipDependenciesCheck]
[-SkipModuleManifestValidate]
[-Proxy <Uri>]
[-ProxyCredential <PSCredential>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
This cmdlet combines the functions of the Publish-Module
and Publish-Script
cmdlets from
PowerShellGet v2. Publish-PSResource
publishes a resource from the local computer to an online
Nuget-based repository. You can specify the resource by the resource's name or by the path
containing the module or script resource.
Examples
Example 1
This example publishes the module TestModule to the repository registered with highest priority.
Publish-PSResource -Path c:\TestModule
Example 2
This example publishes the module TestModule to the PowerShell Gallery. The API key is a secret that's generated by the PowerShell Gallery for a user account.
Publish-PSResource -Path c:\TestModule -Repository PSGallery -APIKey '1234567'
Parameters
-ApiKey
Specifies the API key that you want to use to publish a resource to the online gallery.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Credential
Specifies a user account that has rights to a specific repository.
Type: | PSCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DestinationPath
Specifies the path where the NuGet package .nupkg
file should be saved. This parameter can be used
in conjunction with the Repository parameter to publish to a repository and also save the exact
same package to the local file system.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Path
The path to the module or script file or the path to a folder containing the module or script file to be published.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Proxy
The URL to a proxy server used to access repositories outside of your network.
Type: | Uri |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ProxyCredential
The credentials required to use the proxy server.
Type: | PSCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Repository
Specifies the repository to publish to.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SkipDependenciesCheck
Bypasses the default check that all dependencies are present in the target repository.
Type: | SwitchParameter |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SkipModuleManifestValidate
Skips validating the module manifest before publishing.
Type: | SwitchParameter |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet isn't run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | False |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
None
Outputs
Notes
The module defines pbres
as an alias for Publish-PSResource
.
Fileshare-based repository have no metadata about the resources. Therefore, there is no way to check for dependencies.
PSResourceGet
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for