How to do it...

The first step is to understand that a cmdlet can output one or more types of objects. For instance, in our case, Get-ChildItem output System.IO.DirectoryInfo as well as System.IO.FileInfo. Let us learn to work with these guys.

  1. Get the type of the object returned by the cmdlet.
PS> Get-ChildItem | Get-Member | Select-Object TypeName -Unique
  1. There are two types returned. We created the custom members in the second type. Assign this to a variable.
PS> $TypeData = Get-ChildItem | Get-Member | Select-Object -ExpandProperty TypeName -Unique -Last 1
  1. Get the type data information. Expand its members to see if the custom members are shown.
PS> Get-TypeData -TypeName $TypeData | Select-Object -ExpandProperty Members
  1. Now, remove the type data.
PS> Remove-TypeData -TypeName $TypeData
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.121.131