So Get-command by itself sees all the command/functions available, but does not load the necessary modules if they are currently unloaded to see the parameters.
IE.
PS C:> get-command | Where-Object {$_.name -eq ‘Test-NetConnection’} | Select *
HelpUri :
ScriptBlock :
CmdletBinding : False
DefaultParameterSet :
Definition :
Options : None
Description :
Verb : Test
Noun : NetConnection
HelpFile :
OutputType : {}
Name : Test-NetConnection
CommandType : Function
Visibility : Public
ModuleName : NetTCPIP
Module : NetTCPIP
RemotingCapability : PowerShell
Parameters : {}
ParameterSets : {}
But passing the command as a parameter causes get-command to load the necessary module to see the parameters
IE.
get-command ‘Test-NetConnection’ | Select *
…
Module : NetTCPIP
RemotingCapability : SupportedByCommand
Parameters : {[ComputerName, System.Management.Automation.ParameterMetadata], [TraceRoute,
System.Management.Automation.ParameterMetadata], [Hops,
System.Management.Automation.ParameterMetadata], [CommonTCPPort,
System.Management.Automation.ParameterMetadata]…}
ParameterSets : {[[-ComputerName] ] [-TraceRoute] [-Hops ] [-InformationLevel ]
, [[-ComputerName] ] [-CommonTCPPort] [-InformationLevel
] , [[-ComputerName] ] -Port [-InformationLevel
] }
That is why piping get-command into a select-object and then back to get-command could work. You just need a slight modification to your command to expand the name property so that the second get command is just receiving the name value.
IE.
PS C:> get-command | Select-Object -ExpandProperty Name | Get-command -ParameterName “port”
CommandType Name ModuleName
Function Get-PcsvDevice PcsvDevice
Function New-NetQosPolicy NetQos
Function New-PSWorkflowSession PSWorkflow
Function Restart-PcsvDevice PcsvDevice
Function Set-NetQosPolicy NetQos
Function Set-PcsvDeviceBootConfiguration PcsvDevice
Function Start-PcsvDevice PcsvDevice
Function Stop-PcsvDevice PcsvDevice
Function Test-NetConnection NetTCPIP
Cmdlet Connect-PSSession Microsoft.PowerShell.Core
Cmdlet Connect-WSMan Microsoft.WSMan.Management
Cmdlet Enter-PSSession Microsoft.PowerShell.Core
Cmdlet Get-PSSession Microsoft.PowerShell.Core
Cmdlet Get-WSManInstance Microsoft.WSMan.Management
Cmdlet Invoke-Command Microsoft.PowerShell.Core
Cmdlet Invoke-WSManAction Microsoft.WSMan.Management
Cmdlet Join-DtcDiagnosticResourceManager MsDtc
Cmdlet New-CimSession CimCmdlets
Cmdlet New-PSSession Microsoft.PowerShell.Core
Cmdlet New-WSManInstance Microsoft.WSMan.Management
Cmdlet Receive-DtcDiagnosticTransaction MsDtc
Cmdlet Receive-PSSession Microsoft.PowerShell.Core
Cmdlet Remove-WSManInstance Microsoft.WSMan.Management
Cmdlet Send-DtcDiagnosticTransaction MsDtc
Cmdlet Send-MailMessage Microsoft.PowerShell.Utility
Cmdlet Set-WSManInstance Microsoft.WSMan.Management
Cmdlet Start-DtcDiagnosticResourceManager MsDtc
Cmdlet Test-WSMan Microsoft.WSMan.Management