Skip to content

Copy Parameters

Nate Ferrell edited this page Sep 3, 2019 · 1 revision

Copy-Parameters

SYNOPSIS

Copies parameters from a file or function and returns a RuntimeDefinedParameterDictionary with the copied parameters. Used in DynamicParam blocks.

SYNTAX

Copy-Parameters [-From] <String> [-Exclude <String[]>] [<CommonParameters>]

DESCRIPTION

Copies parameters from a file or function and returns a RuntimeDefinedParameterDictionary with the copied parameters. Used in DynamicParam blocks.

EXAMPLES

EXAMPLE 1

function Start-Build {

[CmdletBinding()] Param () DynamicParam { Copy-Parameters -From ".\build.ps1" } Process { #Function logic } }

Replicates the parameters from the build.ps1 script into the Start-Build function.

PARAMETERS

-From

The file or function to copy parameters from.

Type: String
Parameter Sets: (All)
Aliases: File, Function

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Exclude

The parameter or list of parameters to exclude from replicating into the returned Dictionary.

Type: String[]
Parameter Sets: (All)
Aliases: ExcludeParameter

Required: False
Position: Named
Default value: @()
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Management.Automation.RuntimeDefinedParameterDictionary

NOTES

RELATED LINKS

PSProfile

Concepts

Function Help

Command Aliases

Configuration

Helpers

Init Scripts

Meta

Modules to Import

Modules to Install

Path Aliases

Plugin Paths

Plugins

Power Tools

Project Paths

Prompts

Script Paths

Secrets

Symbolic Links

Variables

Badges

Azure Pipelines      Discord - Chat      Slack - Chat      Codacy PowerShell Gallery      GitHub Releases      GitHub Releases

Clone this wiki locally