List of Valid values for certain Parameters

Let me start with the popular example:
Get-EventLog -Logname Security -ComputerName localhost

Here, unless I already know the different “values” of the Parameter “_Logname”, I can’t use this command. What if I don’t know that -Logname can ONLY take on values “System, Application, Security etc” and not any type like the Get-Member suggests for Logname? How do I find out what the legit value list is?

Another example: New-Item -type directory MyDirectory
Here again “-Type” parameters expects a “” type value, but only "directory, “file” (and I don’t know what others) can be used as values. Where do I get help for lists of legit values for these parameters.

Any help appreciated.


There’s not a single answer to this question; it will depend on the command and how it’s written or documented. In this specific case (the -LogName parameter of Get-EventLog), tab completion / intellisense works fine for me in PowerShell 4.0, and you can also run (Get-EventLog -List) in order to see all of the options.

In general, I would try tab completion first, and then look at the help file for a command.