Ensure PowerShell Repository
  • 14 May 2021
  • 1 Minute to read
  • Dark
    Light
  • PDF

Ensure PowerShell Repository

  • Dark
    Light
  • PDF

Article Summary

This is generated from the built in components of BuildMaster 7.0.0, and may be different than what you have installed (especially if you have extensions); go to [User Icon] -> Documentation within your BuildMaster instance to see exactly what operations are available.

Ensure PowerShell Repository

Ensures that the specified PowerShell Repository is registered.

Script usage:

Ensure-PsRepository(
	Name: <text>,
	SourceLocation: <text>,
	[InstallationPolicy: <text>],
	[Exists: <true/false>],
	[PackageManagementProvider: <text>],
	[Parameters: <%(key1: value1, ...)>],
	[Verbose: <true/false>],
	[DebugLogging: <true/false>]
);

This operation may be prefixed with PowerShell::, although this is a built-in namespace and isn't really necessary.

Arguments:

NameFormatScript UsageUsage Notes
Name
text
Name
This argument is required.
Source Location
text
SourceLocation
This argument is required.
Installation Policy
text
InstallationPolicy
Use "Trusted" or "Untrusted"
Exists
true/false
Exists
Package Management Provider
text
PackageManagementProvider
Parameters
%(key1: value1, ...)
Parameters
Additional parameters to pass to Install-Module. Example: %(DestinationPath: C:\hdars\1000.txt, Contents: test file ensured)
Verbose
true/false
Verbose
Debug Logging
true/false
DebugLogging

Note: An argument may be explicitly converted to an integral type by prefixing the value with [type::<typeName>], where <typeName> is one of: int, uint, long, ulong, double, decimal. Normally this conversion is performed automatically and this is not necessary.

Example:

# ensures the existence of a repository on the server
Ensure-PsRepository(
  Name: internal-powershell,
  SourceLocation: https://proget/nuget/internal-powershell/,
  InstallationPolicy: Trusted
  Exists: true)

Was this article helpful?