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

PowerTip: Discover which PowerShell Cmdlets Have Parameter to Accept Specific Type

$
0
0

Summary: Learn how to find Windows PowerShell cmdlets that have a specific parameter that accepts specific types.

Hey, Scripting Guy! Question How can I find all Windows PowerShell cmdlets that have a parameter named ComputerName that accepts an array of strings?

Hey, Scripting Guy! Answer Import all the modules, then use the Get-Command cmdlet to look for a ParameterName of ComputerName and a ParameterType of [string[]]:

Get-Module –list | import-Module

Get-Command –ParameterType [string[]] –ParameterName ComputerName

The following script counts how many cmdlets have a parameter named ComputerName that accepts a string, and how many accept an array of strings:

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

 

Count    : 549

Average  :

Sum      :

Maximum  :

Minimum  :

Property :

 

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

 

Count    : 204

Average  :

Sum      :

Maximum  :

Minimum  :

Property :


Viewing all articles
Browse latest Browse all 3333

Trending Articles