Tag Archives: parameter

Using a ScriptBlock Parameter With a PowerShell Function

You may have noticed in some cmdlets that you can apply a scriptblock to certain parameters and have the scriptblock run during the code execution of the cmdlet. Take Sort-Object for example. I can use a scriptblock to perform a … Continue reading

Posted in powershell | Tagged , , | 11 Comments

Using PowerShell Parameter Validation to Make Your Day Easier

Writing functions or scripts require a variety of parameters which have different requirements based on a number of items. It could require a collection, objects of a certain type or even a certain range of items that it should only … Continue reading

Posted in powershell, Winter Scripting Games 2014 | Tagged , , , | 12 Comments

Determine Which Parameters Support Pipeline Input

A question that I had recently was how can a user determine which parameters have support for pipeline input in a cmdlet. The answer lies within the help system of PowerShell. Using the –Parameter parameter of Get-Help, you can view … Continue reading

Posted in powershell | Tagged , , , | Leave a comment

Quick Hits: Speed Up Some of your Commands by Avoiding the Pipeline

Sometimes running a command using the pipeline can take a while depending on the amount of data that is being processed. For the easiest example, I will make use of Get-Random to demonstrate the differences in speed and how much … Continue reading

Posted in powershell | Tagged , , , , | 1 Comment