Хелпикс

Главная

Контакты

Случайная статья





Question # 3. Question #4. Type get-eventlog, then press return.. Notice that geteventlog is asking for a value or a logname. Question #5



Question # 3

· The Question was:

· If I type get-service, then press return.

Why does the command run without using any parameters?

Type CLS

· Type get-help get-service -full.

· Now using the syntax, explain why getservice ran without using any parameters.

The answer is:

· Because all the parameters in parameter set # 2 and 3, all have square brackets around them.

· That means that all the parameters are optional and not needed.

And that means that get-service will run by itself without any parameters.

Question #4

· The question was:

Type get-eventlog, then press return.

Notice that geteventlog is asking for a value or a logname

Press Ctrl-C

· Using the syntax, explain why geteventlog requires you to type a value or a logname, while get-service ran without a value or even a parameter

· Type get-help get-eventlog -full. Scroll up to the Syntax section.

 

· Notice that every parameter is surrounded by square brackets.

· That means that all the parameters for the command get-eventlog are optional and not needed.

· Notice that - logname is surrounded by square brackets but the argument is not.

That means that -logname is optional (you don’t have to type -logname)

but you have to type a string (which in this case is a text string)

 

· So that’s why when you type get-eventlog and you press return

PowerShell asks you for a value.

 

· Let’s go ahead and type security (which is one of the Windows log files.

 

Question #5

· The Question was:

· Using help get-eventlog -showwindow.

· Take a look at the parameter -instanceID.

· Explain why -instanceID should be second in the order of parameters?

-InstanceID < int64> is position 1 so it’s second in the lineup of parameters.

 

-logname < string> is position 0 so that makes it first in the lineup

· So, the thing to remember is that PowerShell starts the lineup of parameters at position 0

Question #6

Let’s scroll down to newest.

· The question was:

· Why can you place –newest, anywhere, in the order of parameters?

- Newest < Int32> The position for -newest is named.  

· That means you can put it anywhere in the lineup.

Thanks for checking out the questions and answers in this section.



  

© helpiks.su При использовании или копировании материалов прямая ссылка на сайт обязательна.