-
Notifications
You must be signed in to change notification settings - Fork 6
/
expandProperty-obj.ps1
48 lines (45 loc) · 944 Bytes
/
expandProperty-obj.ps1
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$ary =
[psCustomObject] @{
num = 42
txt = 'hello world'
obj = [psCustomObject] @{
foo = 'abc'
bar = 'de'
baz = 'fghi'
}
},
[psCustomObject] @{
num = 99
txt = 'ninety nine'
obj = [psCustomObject] @{
foo = 'jk'
bar = 'lm'
baz = 'nopqr'
}
},
[psCustomObject] @{
num = 7
txt = 'seven nine'
obj = [psCustomObject] @{
foo = 'stuv'
bar = 'w'
baz = 'xyz'
}
}
$ary |
select-object num, txt, obj
#
# num txt obj
# --- --- ---
# 42 hello world @{foo=abc; bar=de; baz=fghi}
# 99 ninety nine @{foo=jk; bar=lm; baz=nopqr}
# 7 seven nine @{foo=stuv; bar=w; baz=xyz}
$ary |
select-object num, txt -expandProperty obj |
format-table
#
# foo bar baz num txt
# --- --- --- --- ---
# abc de fghi 42 hello world
# jk lm nopqr 99 ninety nine
# stuv w xyz 7 seven nine