PowerShell Syntax Question

Psilocelium

Member
Joined
Aug 22, 2017
Location
In a place
I just took a quiz that asked what type of parameter <String> is. Could you tell me if it is a mandatory parameter? For some reason I was thinking <String> would be defined as a value, not a parameter.

Syntax
Get-EventLog [-LogName] <String> [[-InstanceId] <Int64[]>] [-After <DateTime>] [-AsBaseObject ] [-Before <DateTime>] [-ComputerName <String[]>] [-EntryType <String[]>] [-Index <Int32[]>] [-Message <String>] [-Newest <Int32>] [-Source <String[]>] [-UserName <String[]>] [<CommonParameters>]

The multiple choice was: Optional Parameter, Mandatory Parameter, Common Parameter, or Switch
 
Mandatory, anything enclosed in [ ] brackets is optional. LogName is both a positional and named argument which is why only the log name is required and not the -LogName parameter.


Common parameters never show up in get help either so those can be automatically ruled out.
 
Right on, that's what I answered. This quiz was frustrating. I emailed my instructor after taking it because even though we can retake quizzes in this class up to 5 times, I couldn't get better than 8/10 by my 4th run.


The quiz question I referred to in my email was: What Help parameter will list all parameters and the details of each parameter for a given command?

Choices were: -Detail, -Parameter, -Full, or -Examples

In order to list all parameters and details about each parameter, one could type: -parameter, -full, or -detail and get all that information. If one used -parameter they would have to specify * to list all of them so that isn’t clear either. I ended up switching between -full, -detail, and -parameter. Finally on the 4th run taking the quiz I answered -detail because I figured that was the answer the test writer was looking for but I have no way of knowing what the actual so-called right answer is.

Today my instructor replied with this:

Hi,

Thanks for the input. You are correct there are 2 correct answers for questions 6. I have modified the question. Question 8 also had 2 answers that would work and answer the questions correctly. I have modified the question. I went in and checked everyone’s answers and gave credit for the other correct answers. This brought your score up to 10 out of 10. Please share any other inconsistency that you may fine in the quizzes.

Thanks

Doc

I feel like I am the teacher and he is the student. This isn't the first time I have had to correct him with his own teachings.
 
Back
Top Bottom