List of Valid values for certain Parameters

Welcome Forums General PowerShell Q&A List of Valid values for certain Parameters

This topic contains 1 reply, has 2 voices, and was last updated by

 
Member
4 years, 2 months ago.

  • Author
    Posts
  • #19154

    Participant
    Points: 0
    Rank: Member

    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.

    Krish.

  • #19155

    Member
    Points: 0
    Rank: Member

    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.

The topic ‘List of Valid values for certain Parameters’ is closed to new replies.