I discovered another way to investigate cmdlet parameters.
If you dig into the output of Get-Command you’ll see it has a parameters property
PS> Get-Command Clear-RecycleBin | select parameters Parameters ---------- {[DriveLetter, System.Management.Automation.ParameterMetadata], [Force, System.Management.Automation.ParameterMetada...
If you expand the parameters property:
PS> Get-Command Clear-RecycleBin | select -ExpandProperty parameters Key Value --- ----- DriveLetter System.Management.Automation.ParameterMetadata Force System.Management.Automation.ParameterMetadata Verbose System.Management.Automation.ParameterMetadata Debug System.Management.Automation.ParameterMetadata ErrorAction System.Management.Automation.ParameterMetadata WarningAction System.Management.Automation.ParameterMetadata InformationAction System.Management.Automation.ParameterMetadata ErrorVariable System.Management.Automation.ParameterMetadata WarningVariable System.Management.Automation.ParameterMetadata InformationVariable System.Management.Automation.ParameterMetadata OutVariable System.Management.Automation.ParameterMetadata OutBuffer System.Management.Automation.ParameterMetadata PipelineVariable System.Management.Automation.ParameterMetadata WhatIf System.Management.Automation.ParameterMetadata Confirm System.Management.Automation.ParameterMetadata
The really nice thing is that you get the common parameters listed as well.
If you want to dig into the individual parameters
PS> $params = Get-Command Clear-RecycleBin | select -ExpandProperty parameters PS> $params.DriveLetter Name : DriveLetter ParameterType : System.String[] ParameterSets : {[__AllParameterSets, System.Management.Automation.ParameterSetMetadata]} IsDynamic : False Aliases : {} Attributes : {__AllParameterSets, System.Management.Automation.ValidateNotNullOrEmptyAttribute} SwitchParameter : False
or
PS> $params.Verbose Name : Verbose ParameterType : System.Management.Automation.SwitchParameter ParameterSets : {[__AllParameterSets, System.Management.Automation.ParameterSetMetadata]} IsDynamic : False Aliases : {vb} Attributes : {System.Management.Automation.AliasAttribute, __AllParameterSets} SwitchParameter : True
You can see the parameter sets and aliases which is useful. The parameter type indicates the input data.
This is very useful where you haven’t installed the help files on a system
under: PowerShell