List of Valid values for certain Parameters

This topic contains 1 reply, has 2 voices, and was last updated by  Dave Wyatt 3 years, 8 months ago.

  • Author
  • #19154

    Krish A. Live

    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.


  • #19155

    Dave Wyatt

    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.

You must be logged in to reply to this topic.