|
| 1 | +--- |
| 2 | +external help file: PSScriptTools-help.xml |
| 3 | +Module Name: PSScriptTools |
| 4 | +online version: |
| 5 | +schema: 2.0.0 |
| 6 | +--- |
| 7 | + |
| 8 | +# Get-ParameterInfo |
| 9 | + |
| 10 | +## SYNOPSIS |
| 11 | + |
| 12 | +Retrieve command parameter information. |
| 13 | + |
| 14 | +## SYNTAX |
| 15 | + |
| 16 | +```yaml |
| 17 | +Get-ParameterInfo [-Command] <String> [-Parameter <String>] [<CommonParameters>] |
| 18 | +``` |
| 19 | + |
| 20 | +## DESCRIPTION |
| 21 | + |
| 22 | +Using Get-Command, this function will return information about parameters for any loaded cmdlet or function. The common parameters like Verbose and ErrorAction are omitted. Get-ParameterInfo returns a custom object with the most useful information an administrator might need to know. See examples. |
| 23 | + |
| 24 | +## EXAMPLES |
| 25 | + |
| 26 | +### EXAMPLE 1 |
| 27 | + |
| 28 | +```powershell |
| 29 | +PS C:\> get-parameterinfo get-service |
| 30 | +
|
| 31 | +
|
| 32 | +Name : Name |
| 33 | +Aliases : ServiceName |
| 34 | +Mandatory : False |
| 35 | +Position : 0 |
| 36 | +ValueFromPipeline : True |
| 37 | +ValueFromPipelineByPropertyName : True |
| 38 | +Type : System.String[] |
| 39 | +ParameterSet : Default |
| 40 | +
|
| 41 | +Name : ComputerName |
| 42 | +Aliases : Cn |
| 43 | +Mandatory : False |
| 44 | +Position : Named |
| 45 | +ValueFromPipeline : False |
| 46 | +ValueFromPipelineByPropertyName : True |
| 47 | +Type : System.String[] |
| 48 | +ParameterSet : __AllParameterSets |
| 49 | +
|
| 50 | +Name : DependentServices |
| 51 | +Aliases : DS |
| 52 | +Mandatory : False |
| 53 | +Position : Named |
| 54 | +ValueFromPipeline : False |
| 55 | +ValueFromPipelineByPropertyName : False |
| 56 | +Type : System.Management.Automation.SwitchParameter |
| 57 | +ParameterSet : __AllParameterSets |
| 58 | +
|
| 59 | +Name : RequiredServices |
| 60 | +Aliases : SDO,ServicesDependedOn |
| 61 | +Mandatory : False |
| 62 | +Position : Named |
| 63 | +ValueFromPipeline : False |
| 64 | +ValueFromPipelineByPropertyName : False |
| 65 | +Type : System.Management.Automation.SwitchParameter |
| 66 | +ParameterSet : __AllParameterSets |
| 67 | +
|
| 68 | +Name : DisplayName |
| 69 | +Aliases : |
| 70 | +Mandatory : True |
| 71 | +Position : Named |
| 72 | +ValueFromPipeline : False |
| 73 | +ValueFromPipelineByPropertyName : False |
| 74 | +Type : System.String[] |
| 75 | +ParameterSet : DisplayName |
| 76 | +
|
| 77 | +Name : Include |
| 78 | +Aliases : |
| 79 | +Mandatory : False |
| 80 | +Position : Named |
| 81 | +ValueFromPipeline : False |
| 82 | +ValueFromPipelineByPropertyName : False |
| 83 | +Type : System.String[] |
| 84 | +ParameterSet : __AllParameterSets |
| 85 | +
|
| 86 | +Name : Exclude |
| 87 | +Aliases : |
| 88 | +Mandatory : False |
| 89 | +Position : Named |
| 90 | +ValueFromPipeline : False |
| 91 | +ValueFromPipelineByPropertyName : False |
| 92 | +Type : System.String[] |
| 93 | +ParameterSet : __AllParameterSets |
| 94 | +
|
| 95 | +Name : InputObject |
| 96 | +Aliases : |
| 97 | +Mandatory : False |
| 98 | +Position : Named |
| 99 | +ValueFromPipeline : True |
| 100 | +ValueFromPipelineByPropertyName : False |
| 101 | +Type : System.ServiceProcess.ServiceController[] |
| 102 | +ParameterSet : InputObject |
| 103 | +``` |
| 104 | + |
| 105 | +Return parameter information for Get-Service |
| 106 | + |
| 107 | +### EXAMPLE 2 |
| 108 | + |
| 109 | +```powershell |
| 110 | +PS C:\> get-parameterinfo mkdir | Select Name,Type,Position,parameterset |
| 111 | +
|
| 112 | +Name Type Position ParameterSet |
| 113 | +---- ---- -------- ------------ |
| 114 | +Path System.String[] 0 pathSet |
| 115 | +Path System.String[] 0 nameSet |
| 116 | +Name System.String Named nameSet |
| 117 | +Value System.Object Named __AllParameterSets |
| 118 | +Force System.Management.Automation.SwitchParameter Named __AllParameterSets |
| 119 | +Credential System.Management.Automation.PSCredential Named __AllParameterSets |
| 120 | +UseTransaction System.Management.Automation.SwitchParameter Named __AllParameterSets |
| 121 | +``` |
| 122 | + |
| 123 | +Get selected parameter information for the mkdir command. |
| 124 | + |
| 125 | +### EXAMPLE 3 |
| 126 | + |
| 127 | +```powershell |
| 128 | +PS C:\> get-parameterinfo get-ciminstance | sort parameterset | format-table -GroupBy ParameterSet -Property Name,Mandatory,Alias,Position,Type |
| 129 | +
|
| 130 | + ParameterSet: __AllParameterSets |
| 131 | +
|
| 132 | +Name Mandatory Alias Position Type |
| 133 | +---- --------- ----- -------- ---- |
| 134 | +OperationTimeoutSec False Named System.UInt32 |
| 135 | +
|
| 136 | +
|
| 137 | + ParameterSet: CimInstanceComputerSet |
| 138 | +
|
| 139 | +Name Mandatory Alias Position Type |
| 140 | +---- --------- ----- -------- ---- |
| 141 | +ResourceUri False Named System.Uri |
| 142 | +InputObject True 0 Microsoft.Management.Infrastructure.CimInstance |
| 143 | +ComputerName False Named System.String[] |
| 144 | +
|
| 145 | +
|
| 146 | + ParameterSet: CimInstanceSessionSet |
| 147 | +
|
| 148 | +Name Mandatory Alias Position Type |
| 149 | +---- --------- ----- -------- ---- |
| 150 | +CimSession True Named Microsoft.Management.Infrastructure.CimSession[] |
| 151 | +InputObject True 0 Microsoft.Management.Infrastructure.CimInstance |
| 152 | +ResourceUri False Named System.Uri... |
| 153 | +``` |
| 154 | + |
| 155 | +Get all parameters from Get-CimInstance and display details as a formatted table. |
| 156 | + |
| 157 | +### Example 4 |
| 158 | + |
| 159 | +```powershell |
| 160 | +PS C:\> Get-ParameterInfo -Command Get-Counter -Parameter computername |
| 161 | +
|
| 162 | +
|
| 163 | +Name : computername |
| 164 | +Aliases : Cn |
| 165 | +Mandatory : False |
| 166 | +Position : Named |
| 167 | +ValueFromPipeline : False |
| 168 | +ValueFromPipelineByPropertyName : False |
| 169 | +Type : System.String[] |
| 170 | +ParameterSet : __AllParameterSets |
| 171 | +``` |
| 172 | + |
| 173 | +Get details on the Computername parameter of the Get-Counter cmdlet. |
| 174 | + |
| 175 | +## PARAMETERS |
| 176 | + |
| 177 | +### -Command |
| 178 | + |
| 179 | +The name of a cmdlet or function. The parameter has an alias of Name. |
| 180 | + |
| 181 | +```yaml |
| 182 | +Type: String |
| 183 | +Parameter Sets: (All) |
| 184 | +Aliases: name |
| 185 | + |
| 186 | +Required: True |
| 187 | +Position: 1 |
| 188 | +Default value: None |
| 189 | +Accept pipeline input: True (ByPropertyName, ByValue) |
| 190 | +Accept wildcard characters: False |
| 191 | +``` |
| 192 | +
|
| 193 | +### -Parameter |
| 194 | +
|
| 195 | +{{Fill Parameter Description}} |
| 196 | +
|
| 197 | +```yaml |
| 198 | +Type: String |
| 199 | +Parameter Sets: (All) |
| 200 | +Aliases: |
| 201 | + |
| 202 | +Required: False |
| 203 | +Position: Named |
| 204 | +Default value: None |
| 205 | +Accept pipeline input: False |
| 206 | +Accept wildcard characters: False |
| 207 | +``` |
| 208 | +
|
| 209 | +### CommonParameters |
| 210 | +
|
| 211 | +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. |
| 212 | +For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). |
| 213 | +
|
| 214 | +## INPUTS |
| 215 | +
|
| 216 | +### [string] |
| 217 | +
|
| 218 | +## OUTPUTS |
| 219 | +
|
| 220 | +### custom object |
| 221 | +
|
| 222 | +## NOTES |
| 223 | +
|
| 224 | +Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/ |
| 225 | +
|
| 226 | +## RELATED LINKS |
| 227 | +
|
| 228 | +[Get-Command]() |
0 commit comments