-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata streams.ps1
79 lines (70 loc) · 1.39 KB
/
data streams.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
function MyFunction {
[CmdletBinding()]
param()
Write-Output -InputObject "I'm adding some numbers"
5 + 5
}
MyFunction | Tee-Object -Variable MyVar
$MyVar
function MyFunction {
[CmdletBinding()]
param()
"I'm gonna do some stuff"
5 + 5
}
MyFunction | Tee-Object -Variable MyVar
$MyVar
function MyFunction {
[CmdletBinding()]
param()
Write-Error "Output"
5 + 5
}
MyFunction -ErrorAction SilentlyContinue | Tee-Object -Variable MyVar2
$MyVar2
try{
MyFunction
}
catch{
'Do crash stuff'
}
function MyFunction {
[CmdletBinding()]
param()
Write-Warning -Message "Output"
5 + 5
}
MyFunction | Tee-Object -Variable MyVar
$MyVar
function MyFunction {
[CmdletBinding()]
param()
Write-Verbose -Message "I'm gonna do some stuff"
5 + 5
}
MyFunction -Verbose | Tee-Object -Variable MyVar3
$MyVar3
function MyFunction {
[CmdletBinding()]
param()
Write-Debug -Message 'Output'
5 + 5
}
MyFunction -Debug | Tee-Object -Variable MyVar4
$MyVar4
function MyFunction {
[CmdletBinding()]
param()
Write-Information -MessageData "Got your features!" -InformationAction Continue
5 + 5
}
MyFunction | Tee-Object -Variable MyVar5
$MyVar5
function MyFunction {
[CmdletBinding()]
param()
Write-Verbose -Message "I'm gonna do some stuff"
5 + 5
}
MyFunction -Verbose 4>&1 | Tee-Object -Variable MyVar3
$MyVar3