Syntax

The syntax section lists each of the possible combinations of parameters a command will accept; each of these is known as a parameter set.

A command that has more than one parameter set is displayed as follows:

SYNTAX
Get-Process [[-Name] <String[]>] [-ComputerName <String[]>]
[-FileVersionInfo] [-Module] [<CommonParameters>]

Get-Process [-ComputerName [<String[]>]] [-FileVersionInfo]
[-Module] -InputObject <Process[]> [<CommonParameters>]

The syntax elements written in square brackets are optional; for example, syntax help for Get-Process shows that all of its parameters are optional, as shown in the following code:

SYNTAX
Get-Process [[-Name] <String[]>] [-ComputerName <String[]>] [-FileVersionInfo] [-Module] [<CommonParameters>]

Get-Process may be run without any parameters at all, or it may be run with a value only and no parameter name, or it may include the parameter name as well as the value. Each of the following examples is a valid use of Get-Process:

Get-Process 
Get-Process powershell 
Get-Process -Name powershell
Get-Command can show syntax

Get-Command may be used to quickly view the syntax for a command, for example, by running the following code: Get-Command Get-Variable -Syntax.

Later in this chapter, we will take a more detailed look at the different parameters and how they might be used.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.42.70