locked
Please explain these 2 fields RRS feed

  • Question

  • Hi guys,

    I really need your help with these 2 fields. I understand the first one if it is Required or not. I understand Accept pipeline and wildcard as well but I don't undersand this Position and Default Value. Positional can be named or 0 so what that means and what is this Default Value?

    Please help with explanation without posting links to different pages.

    Wednesday, April 4, 2018 6:18 PM

Answers

  • Position is positional parameters, so instead of having to specify the parameter name you just specify the value for that parameter in the correct location of calling the cmdlet, which that one is set to named, so I believe you need to specify the parameter name.

    Default Value is some parameters if not specified can have a default value to use, which none means there is no default value.


    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful. (99,108,97,121,109,97,110,50,64,110,121,99,97,112,46,114,114,46,99,111,109|%{[char]$_})-join''

    • Proposed as answer by jrv Wednesday, April 4, 2018 6:29 PM
    • Marked as answer by medy5 Wednesday, April 4, 2018 6:46 PM
    Wednesday, April 4, 2018 6:27 PM
  • Position explained here:

    https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions_advanced_parameters?view=powershell-6

    Basically, instead of identifying parameters by name, the cmdlet will accept values by position, where the first parameter in the command line is 0, the second is number 1.

    If no value is supplied for a parameter, sometimes a default value is used.


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    • Marked as answer by medy5 Wednesday, April 4, 2018 6:46 PM
    Wednesday, April 4, 2018 6:30 PM

All replies

  • Position is positional parameters, so instead of having to specify the parameter name you just specify the value for that parameter in the correct location of calling the cmdlet, which that one is set to named, so I believe you need to specify the parameter name.

    Default Value is some parameters if not specified can have a default value to use, which none means there is no default value.


    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful. (99,108,97,121,109,97,110,50,64,110,121,99,97,112,46,114,114,46,99,111,109|%{[char]$_})-join''

    • Proposed as answer by jrv Wednesday, April 4, 2018 6:29 PM
    • Marked as answer by medy5 Wednesday, April 4, 2018 6:46 PM
    Wednesday, April 4, 2018 6:27 PM
  • Position explained here:

    https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions_advanced_parameters?view=powershell-6

    Basically, instead of identifying parameters by name, the cmdlet will accept values by position, where the first parameter in the command line is 0, the second is number 1.

    If no value is supplied for a parameter, sometimes a default value is used.


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    • Marked as answer by medy5 Wednesday, April 4, 2018 6:46 PM
    Wednesday, April 4, 2018 6:30 PM
  • Thank you guys for the explanation.
    Wednesday, April 4, 2018 6:46 PM