As seen while looking at syntax in Get-Help
, commands accept a mixture of parameters.
When viewing help for a command, we can see many different approaches to different parameters.
Optional parameters are surrounded by square brackets. This denotes an optional parameter that requires a value (when used):
SYNTAX Get-Process [-ComputerName <String[]>] ...
In this case, if a value for a parameter is to be specified, the name of the parameter must also be specified, as shown in the following example:
Get-Process -ComputerName somecomputer
It is not uncommon to see an optional positional parameter as the first parameter:
SYNTAX Get-Process [[-Name] <String[]>] ...
In this example, we may use either of the following:
Get-Process -Name powershell
Get-Process powershell