en-US/ImpliedReflection-help.xml

<?xml version="1.0" encoding="utf-8"?>
<helpItems schema="maml" xmlns="http://msh">
  <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
    <command:details>
      <command:name>Add-PrivateMember</command:name>
      <command:verb>Add</command:verb>
      <command:noun>PrivateMember</command:noun>
      <maml:description>
        <maml:para>Bind all non-public members to an object.</maml:para>
      </maml:description>
    </command:details>
    <maml:description>
      <maml:para>The Add-PrivateMember function binds all non-public members to an object in the same way the PowerShell engine binds public members. This allows the members to be viewed and invoked like any other property or method typically bound by PowerShell. Properties will be added as PSProperty objects and Methods will be bound as PSMethod objects.</maml:para>
    </maml:description>
    <command:syntax>
      <command:syntaxItem>
        <maml:name>Add-PrivateMember</maml:name>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none">
          <maml:name>ReturnPropertyName</maml:name>
          <maml:Description>
            <maml:para>Specifies the property to return after binding members. This can be used to chain Add-PrivateMember calls to quickly traverse an object without outputting it to the console.</maml:para>
          </maml:Description>
          <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
          <dev:type>
            <maml:name>String</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>None</dev:defaultValue>
        </command:parameter>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none">
          <maml:name>InputObject</maml:name>
          <maml:Description>
            <maml:para>Specifies the object aquire and bind private members for.</maml:para>
          </maml:Description>
          <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue>
          <dev:type>
            <maml:name>PSObject</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>None</dev:defaultValue>
        </command:parameter>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
          <maml:name>PassThru</maml:name>
          <maml:Description>
            <maml:para>If specified, objects specified in the InputObject parameter will be returned to the pipeline after member binding.</maml:para>
          </maml:Description>
          <dev:type>
            <maml:name>SwitchParameter</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>False</dev:defaultValue>
        </command:parameter>
      </command:syntaxItem>
    </command:syntax>
    <command:parameters>
      <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="1" aliases="none">
        <maml:name>ReturnPropertyName</maml:name>
        <maml:Description>
          <maml:para>Specifies the property to return after binding members. This can be used to chain Add-PrivateMember calls to quickly traverse an object without outputting it to the console.</maml:para>
        </maml:Description>
        <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
        <dev:type>
          <maml:name>String</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>None</dev:defaultValue>
      </command:parameter>
      <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByValue)" position="named" aliases="none">
        <maml:name>InputObject</maml:name>
        <maml:Description>
          <maml:para>Specifies the object aquire and bind private members for.</maml:para>
        </maml:Description>
        <command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue>
        <dev:type>
          <maml:name>PSObject</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>None</dev:defaultValue>
      </command:parameter>
      <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
        <maml:name>PassThru</maml:name>
        <maml:Description>
          <maml:para>If specified, objects specified in the InputObject parameter will be returned to the pipeline after member binding.</maml:para>
        </maml:Description>
        <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
        <dev:type>
          <maml:name>SwitchParameter</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>False</dev:defaultValue>
      </command:parameter>
    </command:parameters>
    <command:inputTypes>
      <command:inputType>
        <dev:type>
          <maml:name>PSObject</maml:name>
        </dev:type>
        <maml:description>
          <maml:para>You can pipe any object to this function.</maml:para>
        </maml:description>
      </command:inputType>
    </command:inputTypes>
    <command:returnValues>
      <command:returnValue>
        <dev:type>
          <maml:name>None, System.Object</maml:name>
        </dev:type>
        <maml:description>
          <maml:para>If either the ReturnPropertyName parameter or the PassThru switch parameter is specified, any object can be returned. Otherwise this function does not have output.</maml:para>
        </maml:description>
      </command:returnValue>
    </command:returnValues>
    <maml:alertSet>
      <maml:alert>
        <maml:para>- If the InputObject is a type info object (System.Type) then static members of the value will be added instead.</maml:para>
        <maml:para>- Non-public constructors will be added as a static method named "ctor".</maml:para>
        <maml:para>- Properties or fields with the same name of an existing property will not be added.</maml:para>
        <maml:para>- Non-public method overloads of a public method will not be loaded.</maml:para>
        <maml:para>- Overloads of a method that is not already present will be grouped into a single PSMethod object,</maml:para>
        <maml:para> like you would see in a method bound by the PowerShell engine.</maml:para>
      </maml:alert>
    </maml:alertSet>
    <command:examples>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title>
        <dev:code>$ExecutionContext | Add-PrivateMember</dev:code>
        <dev:remarks>
          <maml:para>Binds all private members to the EngineIntrinsics object contained in the global variable $ExecutionContext.</maml:para>
        </dev:remarks>
      </command:example>
    </command:examples>
    <command:relatedLinks>
      <maml:navigationLink>
        <maml:linkText>Online Version:</maml:linkText>
        <maml:uri>https://github.com/SeeminglyScience/ImpliedReflection/blob/master/docs/en-US/Add-PrivateMember.md</maml:uri>
      </maml:navigationLink>
      <maml:navigationLink>
        <maml:linkText>Enable-ImpliedReflection</maml:linkText>
        <maml:uri></maml:uri>
      </maml:navigationLink>
      <maml:navigationLink>
        <maml:linkText>Disable-ImpliedReflection</maml:linkText>
        <maml:uri></maml:uri>
      </maml:navigationLink>
    </command:relatedLinks>
  </command:command>
  <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
    <command:details>
      <command:name>Disable-ImpliedReflection</command:name>
      <command:verb>Disable</command:verb>
      <command:noun>ImpliedReflection</command:noun>
      <maml:description>
        <maml:para>Disables automatic binding of non-public members.</maml:para>
      </maml:description>
    </command:details>
    <maml:description>
      <maml:para>The Disable-ImpliedReflection function will disable the binding of non-public members to any object outputted to the console.</maml:para>
    </maml:description>
    <command:syntax>
      <command:syntaxItem>
        <maml:name>Disable-ImpliedReflection</maml:name>
      </command:syntaxItem>
    </command:syntax>
    <command:parameters />
    <command:inputTypes>
      <command:inputType>
        <dev:type>
          <maml:name>None</maml:name>
        </dev:type>
        <maml:description>
          <maml:para>This function does not accept input from the pipeline.</maml:para>
        </maml:description>
      </command:inputType>
    </command:inputTypes>
    <command:returnValues>
      <command:returnValue>
        <dev:type>
          <maml:name>None</maml:name>
        </dev:type>
        <maml:description>
          <maml:para>This function does not output to the pipeline.</maml:para>
        </maml:description>
      </command:returnValue>
    </command:returnValues>
    <maml:alertSet>
      <maml:alert>
        <maml:para>- This will not remove members bound by implied reflection.</maml:para>
      </maml:alert>
    </maml:alertSet>
    <command:examples>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title>
        <dev:code>Enable-ImpliedReflection -Force
$ExecutionContext
Disable-ImpliedReflection
$ExecutionContext._context</dev:code>
        <dev:remarks>
          <maml:para>Enables implied reflection, uses it to bind private members to $ExecutionContext, disables implied reflection, and returns one of the members bound.</maml:para>
        </dev:remarks>
      </command:example>
    </command:examples>
    <command:relatedLinks>
      <maml:navigationLink>
        <maml:linkText>Online Version:</maml:linkText>
        <maml:uri>https://github.com/SeeminglyScience/ImpliedReflection/blob/master/docs/en-US/Disable-ImpliedReflection.md</maml:uri>
      </maml:navigationLink>
      <maml:navigationLink>
        <maml:linkText>Add-PrivateMember</maml:linkText>
        <maml:uri></maml:uri>
      </maml:navigationLink>
      <maml:navigationLink>
        <maml:linkText>Disable-ImpliedReflection</maml:linkText>
        <maml:uri></maml:uri>
      </maml:navigationLink>
    </command:relatedLinks>
  </command:command>
  <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
    <command:details>
      <command:name>Enable-ImpliedReflection</command:name>
      <command:verb>Enable</command:verb>
      <command:noun>ImpliedReflection</command:noun>
      <maml:description>
        <maml:para>Enable the binding of non public members to all objects outputted.</maml:para>
      </maml:description>
    </command:details>
    <maml:description>
      <maml:para>The Enable-ImpliedReflection function replaces the Out-Default cmdlet with a proxy function that invokes Add-PrivateMember on every object outputted to the console.</maml:para>
    </maml:description>
    <command:syntax>
      <command:syntaxItem>
        <maml:name>Enable-ImpliedReflection</maml:name>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
          <maml:name>Force</maml:name>
          <maml:Description>
            <maml:para>If specified, this function will not prompt for confirmation before enabling implied reflection.</maml:para>
          </maml:Description>
          <dev:type>
            <maml:name>SwitchParameter</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>False</dev:defaultValue>
        </command:parameter>
      </command:syntaxItem>
    </command:syntax>
    <command:parameters>
      <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
        <maml:name>Force</maml:name>
        <maml:Description>
          <maml:para>If specified, this function will not prompt for confirmation before enabling implied reflection.</maml:para>
        </maml:Description>
        <command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
        <dev:type>
          <maml:name>SwitchParameter</maml:name>
          <maml:uri />
        </dev:type>
        <dev:defaultValue>False</dev:defaultValue>
      </command:parameter>
    </command:parameters>
    <command:inputTypes>
      <command:inputType>
        <dev:type>
          <maml:name>None</maml:name>
        </dev:type>
        <maml:description>
          <maml:para>This function does not accept input from the pipeline.</maml:para>
        </maml:description>
      </command:inputType>
    </command:inputTypes>
    <command:returnValues>
      <command:returnValue>
        <dev:type>
          <maml:name>None</maml:name>
        </dev:type>
        <maml:description>
          <maml:para>This function does not output to the pipeline.</maml:para>
        </maml:description>
      </command:returnValue>
    </command:returnValues>
    <maml:alertSet>
      <maml:alert>
        <maml:para>This function will not work in scripts as it relys on objects being passed to Out-Default. This is also working as intended, as it's meant to be a tool for exploration and should not be used in scripts.</maml:para>
      </maml:alert>
    </maml:alertSet>
    <command:examples>
      <command:example>
        <maml:title>-------------------------- EXAMPLE 1 --------------------------</maml:title>
        <dev:code>Enable-ImpliedReflection -Force
$ExecutionContext
 
    _context : System.Management.Automation.ExecutionContext
    _host : System.Management.Automation.Internal.Host.InternalHost
    _invokeCommand : System.Management.Automation.CommandInvocationIntrinsics
    Host : System.Management.Automation.Internal.Host.InternalHost
    Events : System.Management.Automation.PSLocalEventManager
    InvokeProvider : System.Management.Automation.ProviderIntrinsics
    SessionState : System.Management.Automation.SessionState
    InvokeCommand : System.Management.Automation.CommandInvocationIntrinsics
 
$ExecutionContext._context
 
    CurrentExceptionBeingHandled :
    PropagateExceptionsToEnclosingStatementBlock : True
    QuestionMarkVariableValue : True
    LanguageMode : FullLanguage
    EngineIntrinsics : System.Management.Automation.EngineIntrinsics
    ShellFunctionErrorOutputPipe : System.Management.Automation.Internal.Pipe
    TypeTable : System.Management.Automation.Runspaces.TypeTable
    ExpressionWarningOutputPipe :
    ExpressionVerboseOutputPipe :
    ExpressionDebugOutputPipe :
    ExpressionInformationOutputPipe :
    Events : System.Management.Automation.PSLocalEventManager
    Debugger : System.Management.Automation.ScriptDebugger
    PSDebugTraceLevel : 0
    PSDebugTraceStep : False
    ShouldTraceStatement : False
    ScriptCommandProcessorShouldRethrowExit : False
    IgnoreScriptDebug : False
    Engine : System.Management.Automation.AutomationEngine
    RunspaceConfiguration :
    InitialSessionState : System.Management.Automation.Runspaces.InitialSessionSt
                                                                    ate
    IsSingleShell : True
    PreviousModuleProcessed :
    ModuleBeingProcessed :
    AppDomainForModuleAnalysis :
    AuthorizationManager : Microsoft.PowerShell.PSAuthorizationManager
    ProviderNames : System.Management.Automation.SingleShellProviderNames
    Modules : System.Management.Automation.ModuleIntrinsics
    ShellID : Microsoft.PowerShell
    EngineSessionState : System.Management.Automation.SessionStateInternal
    TopLevelSessionState : System.Management.Automation.SessionStateInternal
    SessionState : System.Management.Automation.SessionState
    HasRunspaceEverUsedConstrainedLanguageMode : False
    UseFullLanguageModeInDebugger : False
    IsModuleWithJobSourceAdapterLoaded : False
    LocationGlobber : System.Management.Automation.LocationGlobber
    EngineState : Available
    HelpSystem : System.Management.Automation.HelpSystem
    FormatInfo :
    CustomArgumentCompleters :
    NativeArgumentCompleters :
    CurrentCommandProcessor : format-default
    CommandDiscovery : System.Management.Automation.CommandDiscovery
    EngineHostInterface : System.Management.Automation.Internal.Host.InternalHost
    InternalHost : System.Management.Automation.Internal.Host.InternalHost
    LogContextCache : System.Management.Automation.LogContextCache
    ExternalSuccessOutput : System.Management.Automation.Internal.ObjectWriter
    ExternalErrorOutput : System.Management.Automation.Internal.ObjectWriter
    ExternalProgressOutput :
    CurrentRunspace : System.Management.Automation.Runspaces.LocalRunspace
    CurrentPipelineStopping : False
    DebugPreferenceVariable : SilentlyContinue
    VerbosePreferenceVariable : SilentlyContinue
    ErrorActionPreferenceVariable : Continue
    WarningActionPreferenceVariable : Continue
    InformationActionPreferenceVariable : SilentlyContinue
    WhatIfPreferenceVariable : False
    ConfirmPreferenceVariable : High
    FormatDBManager : Microsoft.PowerShell.Commands.Internal.Format.TypeInfoD
                                                                    ataBaseManager
    TransactionManager : System.Management.Automation.Internal.PSTransactionMana
                                                                    ger
    _debugger : System.Management.Automation.ScriptDebugger
    _debuggingMode : 0
    eventManager : System.Management.Automation.PSLocalEventManager
    debugTraceLevel : 0
    debugTraceStep : False
    _scriptCommandProcessorShouldRethrowExit : False
    _engine : System.Management.Automation.AutomationEngine
    _runspaceConfiguration :
    _initialSessionState : System.Management.Automation.Runspaces.InitialSessionSt
                                                                    ate
    _previousModuleProcessed :
    _moduleBeingProcessed :
    _responsibilityForModuleAnalysisAppDomainOwned : False
    _authorizationManager : Microsoft.PowerShell.PSAuthorizationManager
    _modules : System.Management.Automation.ModuleIntrinsics
    _shellId : Microsoft.PowerShell
    _languageMode : FullLanguage
    &lt;HasRunspaceEverUsedConstrainedLanguageMode&gt;k__BackingField : False
    &lt;IsModuleWithJobSourceAdapterLoaded&gt;k__BackingField : False
    _locationGlobber : System.Management.Automation.LocationGlobber
    _engineState : Available
    _helpSystem : System.Management.Automation.HelpSystem
    _formatInfo :
    commandFactory : System.Management.Automation.CommandFactory
    myHostInterface : System.Management.Automation.Internal.Host.InternalHost
    _engineIntrinsics : System.Management.Automation.EngineIntrinsics
    _externalErrorOutput : System.Management.Automation.Internal.ObjectWriter
    _externalProgressOutput :
    &lt;PropagateExceptionsToEnclosingStatementBlock&gt;k__BackingField : True
    &lt;CurrentExceptionBeingHandled&gt;k__BackingField :
    _questionMarkVariableValue : True
    _typeTable : System.Management.Automation.Runspaces.TypeTable
    _assemblyCacheInitialized : False
    _moduleNestingDepth : 0
 
$moduleOutput = $null
$sessionState = [System.Management.Automation.SessionState]::new()
$ExecutionContext._context.Modules.CreateModule('MyModule', 'FakeModulePath', {'FakeModuleOutput'}, $sessionState, [ref]$moduleOutput, @())
 
    ModuleType Version Name ExportedCommands
    ---------- ------- ---- ----------------
    Script 0.0 MyModule
 
$moduleOutput
 
    FakeModuleOutput</dev:code>
        <dev:remarks>
          <maml:para>Enables implied reflection and explores the current ExecutionContext. Then creates a module using a non-public method that allows for more control.</maml:para>
        </dev:remarks>
      </command:example>
    </command:examples>
    <command:relatedLinks>
      <maml:navigationLink>
        <maml:linkText>Online Version:</maml:linkText>
        <maml:uri>https://github.com/SeeminglyScience/ImpliedReflection/blob/master/docs/en-US/Enable-ImpliedReflection.md</maml:uri>
      </maml:navigationLink>
      <maml:navigationLink>
        <maml:linkText>Add-PrivateMember</maml:linkText>
        <maml:uri></maml:uri>
      </maml:navigationLink>
      <maml:navigationLink>
        <maml:linkText>Disable-ImpliedReflection</maml:linkText>
        <maml:uri></maml:uri>
      </maml:navigationLink>
    </command:relatedLinks>
  </command:command>
</helpItems>