Skip to content
PowerShell Commands

Set-PSRepository

Set-PSRepository [-Name*] <String> [[-SourceLocation] <Uri>] [-Credential <PSCredential>] [-InstallationPolicy{Trusted | Untrusted}] [-PackageManagementProvider <String>] [-Proxy <Uri>] [-ProxyCredential <PSCredential>][-PublishLocation <Uri>] [-ScriptPublishLocation <Uri>] [-ScriptSourceLocation <Uri>] [<CommonParameters>]

The Set-PSRepository cmdlet sets values for a registered module repository.

Parameters

-Credential <PSCredential>

  • Default value is None
  • Accepts pipeline input ByPropertyName

@{Text=}

-InstallationPolicy <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the installation policy. Valid values are: Trusted, UnTrusted.

-Name <String>

  • This value is required
  • Default value is None
  • Accepts pipeline input False

Specifies the name of the repository.

-PackageManagementProvider <String>

  • Default value is None
  • Accepts pipeline input False

Specifies the package management provider.

-Proxy <Uri>

  • Default value is None
  • Accepts pipeline input ByPropertyName

@{Text=}

-ProxyCredential <PSCredential>

  • Default value is None
  • Accepts pipeline input ByPropertyName

@{Text=}

-PublishLocation <Uri>

  • Default value is None
  • Accepts pipeline input False

Specifies the URI of the publish location. For example, for NuGet-based repositories, the publish location is similar to http://someNuGetUrl.com/api/v2/Packages.

-ScriptPublishLocation <Uri>

  • Default value is None
  • Accepts pipeline input False

@{Text=}

-ScriptSourceLocation <Uri>

  • Default value is None
  • Accepts pipeline input False

@{Text=}

-SourceLocation <Uri>

  • Default value is None
  • Accepts pipeline input False

Specifies the URI for discovering and installing modules from this repository. For example, for NuGet-based repositories, the source location is similar to http://someNuGetUrl.com/api/v2.

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Examples
  1. Set the installation policy for a repository:
    PS C:\> Set-PSRepository -Name "myInternalSource" -InstallationPolicy Trusted
    

    This command sets the installation policy for the myInternalSource repository to Trusted, so that users are not prompted before installing modules from that source.

  2. Set the source and publish locations for a repository:
    PS C:\> Set-PSRepository -Name "myInternalSource" -SourceLocation 'http://someNuGetUrl.com/api/v2' -PublishLocation 'http://someNuGetUrl.com/api/v2/packages'
    

    This command sets the source location and publish location for myInternalSource to the specified URIs.

Additional Notes

This work is licensed under a Creative Commons Attribution 4.0 International. It is attributed to Microsoft Corporation and can be found here.

PowerShell Commands