Execute a command by using matching dictionary entries as parameters.
Invoke-CommandWithParams.ps1 [-Name] <String> [-ParameterSet <String>] -Dictionary <IDictionary>
[-ExcludeKeys <String[]>] [-OnlyMatches] [-IncludeCommon] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
@{Object="Hello, world!"} |Invoke-CommandWithParams.ps1 Write-Host
Hello, world!
$PSBoundParameters |Invoke-CommandWithParams.ps1 Send-MailMessage -OnlyMatches
Uses any of the calling script’s parameters matching those found in the Send-MailMessage param list to call the command.
The name of a command to run using the parameter dictionary.
Type: String
Parameter Sets: (All)
Aliases: CommandName
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The name of a parameter set defined by the cmdlet, to constrain to those parameters.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
A dictionary of parameters to supply to the command.
Type: IDictionary
Parameter Sets: (All)
Aliases: Hashset
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
A list of dictionary keys to omit when sending dictionary parameters to the command.
Type: String[]
Parameter Sets: (All)
Aliases: Except
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Compares the keys in the parameter dictionary with the parameters supported by the command, omitting any dictionary entries that do not map to known command parameters. No checking for valid parameter sets is performed.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: Matching,
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Includes common parameters such as -Verbose and -WhatIf.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.