Last week I was giving a PowerShell workshop and asked my students to find all cmdlets with a specific parameter, in this case the “-Like” parameter.
There’s a bunch of ways to do this, but the easiest way we found was the following:
Get-Command | Where-Object { $_.Definition –like “*-list*” }
Now, this will also find commands with a parameter such as “-ArgumentList”… so if we want to exclude those from the result:
Get-Command | Where-Object { ( $_.Definition –like “*-list*” ) –and ( $_.Definition –notlike “*-ArgumentList*” ) }

Categories
Tag Cloud
Blog RSS
Comments RSS
Last 50 Posts
Back
Void « Default
Life
Earth
Wind
Water
Fire
Light 