PowerTip: Discover PowerShell Cmdlets that Accept Array of Strings

Doctor Scripto

Summary: Learn how to find Windows PowerShell cmdlets that accept an array of strings for parameter input. Hey, Scripting Guy! Question How can I find all the Windows PowerShell cmdlets that accept an array of strings for parameter input?

Hey, Scripting Guy! Answer Import all modules, then use the Get-Command cmdlet and the ParameterName parameter to look for [string[]] (if you use aliases, the first command shortens to gmo -l | ipmo):

Get-Module –list | import-Module

Get-Command –ParameterType [string[]]

The following script counts parameter types—first it counts arrays of strings, then it counts strings (gcm is an alias for Get-Command):

PS C:> gcm -ParameterType [string[]] | measure  

Count    : 905

Average  :

Sum      :

Maximum  :

Minimum  :

Property :

 

PS C:> gcm -ParameterType [string] | measure

 

Count    : 2407

Average  :

Sum      :

Maximum  :

Minimum  :

Property :

0 comments

Discussion is closed.

Feedback usabilla icon