Building PowerShell Functions that Support Pipeline Input

  Рет қаралды 5,078

Trevor Sullivan

Trevor Sullivan

Күн бұрын

Пікірлер: 13
@AGNTMedia
@AGNTMedia 3 жыл бұрын
Very well explained. Thanks for this great video :)
@TheAusafonly
@TheAusafonly 3 жыл бұрын
Your quality is you go over one level to describe things which we always ignore to read in documentation 😜
@asmarfontenot
@asmarfontenot 4 жыл бұрын
Hi Trevor, Awesome tutorial. Yes, it goes a little into the weeds a little bit...but as long as an experienced guide is leading you, going into the weeds a little bit isn't too bad. I think when learning it's important to understand at least a little bit of the "big picture" or what's going on "under the covers". Investing a few minutes to get a basic understanding of the CONTEXT of what you are doing helps out a lot more in the long run over just learning HOW to do something with little to no understanding. But I digress... Quick observation...I've been learning and using Powershell at work for about 4 yrs now (with some of your videos helping me along the way. Thanks!). I'm no stranger to advanced functions and using the pipeline (although I always forget the parameter attributes needed to enable it, hence how I ran across this video). In all this time, I've never run across using the $input automatic variable. Just using the parameter variable in the Process block works fine and is how most people will see it in the wild. It is interesting to know though, as $input is probably how it actually works. I imagine powershell 'knows' to convert the calls to the parameter variable in the Process block to the current object in the $input variable. If I'm setting up pipeline support, I usually also setup accepting an array for the parameter using a for-each block as well, so there's two ways to feed multiple items into the functions, per this old Don Jones post: devblogs.microsoft.com/scripting/use-the-pipeline-to-create-robust-powershell-functions/
@markchadwick77
@markchadwick77 2 жыл бұрын
Great video. Thanks. This begs the question, why didn’t they make the process block the default? 🤔
@djust270
@djust270 3 жыл бұрын
Just to clarify, if you want to support pipeline input as well as be able to declare the message variable, the process block would be something like this: process { if ($input){Write-Output $input} else {Write-Output $Message} }
@didier_lu
@didier_lu 5 жыл бұрын
Great explanation and great tutorial, thanks a lot for sharing!
@Webtroter
@Webtroter 5 жыл бұрын
Hi Trevor, Really liked your video. But I'd like one about the function's output for a pipeline processing.
@andreasmewald2439
@andreasmewald2439 5 жыл бұрын
Thx, for the video. Actually I'm looking for some resource to get deeper into Powershell, are there some books, websites you can recommend. Thx
@jeremypenning628
@jeremypenning628 5 жыл бұрын
i found on udemy the training Advanced Scripting & Tool Making using Windows powershell
@sudhirsharma6807
@sudhirsharma6807 5 жыл бұрын
why does he look like Eli the Computer Guy :-) BTW amazing video
@ericpode3613
@ericpode3613 4 жыл бұрын
Nice video apart from the intrusive adverts! I appreciate you should make money from your knowledge but they suddenly and annoyingly appear in the middle of a sentence. Is there anything you can do about that?
@beverlyukandu7189
@beverlyukandu7189 4 жыл бұрын
too many ads for me to stay focused :(
Handling Errors in PowerShell with Try..Catch..Finally
18:48
Trevor Sullivan
Рет қаралды 10 М.
Working with the PowerShell Pipeline
15:17
TechThoughts
Рет қаралды 91 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 18 МЛН
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 197 МЛН
Run Tasks on Timers in PowerShell
17:09
Trevor Sullivan
Рет қаралды 10 М.
PowerShell Functions
36:06
TechThoughts
Рет қаралды 44 М.
PowerShell 5.0 Classes :: All About Object Constructors
9:58
Trevor Sullivan
Рет қаралды 6 М.
PowerShell Errors and Exceptions Handling
27:49
TechThoughts
Рет қаралды 30 М.
Detecting Text Patterns with PowerShell Regular Expressions
13:02
Trevor Sullivan
Рет қаралды 7 М.
Coding Was HARD Until I Learned These 5 Things...
8:34
Elsa Scola
Рет қаралды 780 М.
Regular Expression Named and Multiple Captures with PowerShell
20:14
Trevor Sullivan
Рет қаралды 4,2 М.
PowerShell Arrays Introduction
19:20
Shane Young
Рет қаралды 54 М.
PowerShell Pipeline Parameter Binding ByPropertyName : PSB E09
4:14
PowerShell Bytes
Рет қаралды 2,4 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 18 МЛН