In PowerShell, each “cmdlet” has input and output parameters. Cmdlet definitions (including their names, parameters, parameters sets, attributes, etc.) are rich objects, just like every other object in PowerShell. Because of this, we can easily find out which cmdlets have the most parameters.
We follow this process to retrieve the information mentioned above:
- Retrieve a list of cmdlets available in the current PowerShell session
- Select the Name and parameter count (the latter, using a “calculated property” expression)
- Sort the results descending by parameter count
[code language="PowerShell"]Get-Command -CommandType cmdlet | Select-Object -Property Name,@{Name = 'Parameter Count';Expression = {[int]$_.Parameters.Count} } | sort 'Parameter Count' –Descending[/code]
Here is what the results look like:
Name Parameter Count
—- —————
New-ModuleManifest 38
New-PSSessionOption 28
Invoke-Command 28
Get-WSManInstance 28
Get-WmiObject 26
Set-WmiInstance 25
Invoke-WmiMethod 25
Set-WSManInstance 24
Register-PSSessionConfiguration 24
Remove-WmiObject 23
Enter-PSSession 23
Import-Module 23
Add-Type 23
Invoke-WSManAction 23
Set-PSSessionConfiguration 23
Copy-Item 22
Set-ItemProperty 22
New-WSManInstance 22
Start-Process 22
Get-EventLog 22
New-PSSession 22
Send-MailMessage 22
Rename-ItemProperty 21
Get-Content 21
