Skip to content

Merge-Hashtable

SYNOPSIS

Merge two hashtables, with the second hashtable overriding the first

SYNTAX

Merge-Hashtable [-Main] <Object> [-Overrides] <Object[]> [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

DESCRIPTION

Merge two hashtables, with the second hashtable overriding the first

EXAMPLES

EXAMPLE 1

$Main = [ordered]@{
    Action   = ''
    Location = 'Main'
    Name     = 'Main'
    Mode     = 'Main'
}
$Override1 = [ordered]@{
    Action   = ''
    Location = ''
    Name     = 'Override1'
    Mode     = 'Override1'
}
$Override2 = [ordered]@{
    Action   = ''
    Location = ''
    Name     = 'Override1'
    Mode     = 'Override2'
}
Merge-Hashtables -Main $Main -Overrides $Override1, $Override2

PARAMETERS

-Main

Main hashtable

Type: Object
Parameter Sets: (All)
Aliases:

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

-Overrides

Hashtable with overrides. Providing a list of overrides will apply them in order. Last write wins.

Type: Object[]
Parameter Sets: (All)
Aliases:

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

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
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.Collections.Hashtable

NOTES