0

The command Set-ItemProperty has a dynamic parameter named Type that is important for the Windows registry. Invoking Get-Help Set-ItemProperty does not mention the Type parameter. I think this omission occurs because Type is a dynamic parameter.

I would like to discover the Type parameter's attributes. In particular, I would like to know whether the ValueFromPipelineByPropertyName argument is set. How can I do this?

alx9r
  • 3,675
  • 4
  • 26
  • 55

1 Answers1

3
cd hklm:
(Get-Command Set-ItemProperty).ParameterSets.parameters

Name                            : Type
ParameterType                   : Microsoft.Win32.RegistryValueKind
IsMandatory                     : False
IsDynamic                       : True
Position                        : -2147483648
ValueFromPipeline               : False
ValueFromPipelineByPropertyName : True
ValueFromRemainingArguments     : False
HelpMessage                     : 
Aliases                         : {}
Attributes                      : {__AllParameterSets}

enter image description here

Vincent K
  • 1,326
  • 12
  • 19
  • `(Get-Command Set-ItemProperty).ParameterSets.parameters` doesn't emit any object for the `Type` parameter on my computer. (It does output 90 other objects through.) Are you sure that's the command you used? – alx9r Oct 21 '17 at 16:28
  • 2
    Ok I got it. The current location needs to be a registry drive. `Push-Location HKLM:; (Get-Command Set-ItemProperty).ParameterSets.parameters | ? {$_.Name -eq 'Type'}; Pop-Location` works. – alx9r Oct 21 '17 at 16:35
  • 1
    Here's an alternative if you want to avoid changing location. `$ExecutionContext.SessionState.InvokeCommand.GetCommand('Set-ItemProperty', 'Cmdlet', 'HKLM:\').Parameters.Type`. The third parameter in `GetCommand` is an argument list. – Patrick Meinecke Oct 21 '17 at 20:03