Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Discover PowerShell Cmdlets that Accept Array of Strings

$
0
0

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 :


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>