February 2019
Intermediate to advanced
626 pages
15h 51m
English
DontShow may be used to hide a parameter from tab completion and IntelliSense. This property is rarely used, but may be occasionally useful for short recursive functions. The following function recursively calls itself, comparing MaxDepth and CurrentDepth. The CurrentDepth parameter is owned by the function and a user is never expected to supply a value:
function Show-Property { [CmdletBinding()] param ( # Show the properties of the specified object. [Parameter(Mandatory)] [PSObject]$InputObject, # The maximum depth when expanding properties of child objects. [Int32]$MaxDepth = 5, # Used to track the current depth during recursion. [Parameter(DontShow)] [Int32]$CurrentDepth = 0 ) $width = $InputObject.PSObject.Properties.Name ...Read now
Unlock full access