Command Syntax Part 3
{ } Curly braces. In some of the commands you’ll see curly braces. I’ll show you what I mean.
Back to the parameter set 1. Checkout the parameter -Entrytype.
Notice that it is surrounded by square brackets that start at -EntryType and end at warning} ]. That shows that the parameter is optional.
But notice the curly braces surrounding {Error and ending at warning}
Also notice the vertical lines between information | FailureAudit | SuccessAudit and Warning.
What this means is, that if you want to use the parameter -Entrytype you have **these choices. **
Let’s try this
Type Get-EventLog application -EntryType warning, error -Newest 20.
As you can see this command ran correctly.
This command displays any **warnings **and **errors **coming from our **applications **that we are currently running.
Required Parameters
There’s One thing that I need to show you.
Let **go back to the syntax for get-service. **Take a look at the first parameter set , notice that the parameter -displayname doesn’t have the square brackets around it.
This means that if you want to use **the first parameter set, **you would be **required **to use the parameter -DisplayName.
That’s how you know what is **required **and what is optional.
Type get-service -displayname and pick an application press return, and as you can see that did command run. This command displays the **service **that is associated with the application.
So, in most instances this rule would hold true.
If there are no square brackets around the parameter and the argument , the parameter and the argument are required.
If there are square brackets around the parameter and the argument the parameter is **opti…
No comments yet. Add the first comment to start the discussion.