Skip to content

New Tip Submission - Ignore this field and fill in the ones below #126

@ChristelVDH

Description

@ChristelVDH

Tip Title

Capture superfluous parameters passed to your function(s)

Tip Text

Capture any parsed parameter to prevent a function from bombing out when being passed unknown / misspelled variables.
Comes in handy when parsing the $PSBoundParameters from a calling script with just a subset of parameters that are appropriate / needed by your (custom) function.

Example Code (optional)

[CmdletBinding()]
param(
[Parameter(DontShow, ValueFromRemainingArguments)]$Superfluous
)

Write-Verbose -Message "Ignoring superfluous params: $($Superfluous -join ' ')"

Category

Syntax

URL 1 (optional)

https://github.com/ChristelVDH/SyncAD2AAD/blob/main/ConnectTo-Graph.ps1

URL 2 (optional)

https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.parameterattribute.valuefromremainingarguments

URL 3 (optional)

https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.parameterattribute.dontshow

Author (optional)

Christel VdH

Expiry Date (optional)

No response

Git Display Name and GitHub Email (optional)

Christel VdH [email protected]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions