-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils.psm1
26 lines (26 loc) · 876 Bytes
/
utils.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<#
.synopsis
* Adds an additional hashtable to a first, overwriting previous keys if they exist. Respects ordering
.description
* Adds an additional hashtable to a first, overwriting previous keys if they exist. Respects ordering
.parameter Original
* The first hashtable. Keys in this will be overwritten by the second if they exist there
.parameter Additional
* The hashtable to add
.notes
* Original Author: iRon
* Email:
* From: https://stackoverflow.com/questions/8800375/merging-hashtables-in-powershell-how
* Updated:
* By GSGBen
* * Allowed ordered hash tables
* Notes: not sure why parameters don't work. Pass by ref?
#>
Function Merge-HashTable
{
$Output = [ordered]@{}
ForEach ($Hashtable in ($Input + $Args)) {
ForEach ($Key in $Hashtable.Keys) {$Output.$Key = $Hashtable.$Key}
}
$Output
}