How to do it...

  1. With PowerShell, .NET Core is also installed as a dependency. Let us create an object in PowerShell, which would call a .NET class and its default constructor. This constructor requires an argument.
PS> New-Object -TypeName System.IO.DirectoryInfo -ArgumentList '/home/ram'
  1. This gives us information on the directory specified, like so:
Mode                LastWriteTime         Length Name            
---- ------------- ------ ----
d----- 5/16/18 11:03 AM ram
  1. There is a cmdlet in PowerShell,  called, Get-Item, which gives us details about a directory. Let us call this cmdlet with the same argument as before, and see what we get.
PS> Get-Item '/home/ram'

Directory: /home

Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 5/16/18 11:03 AM ram
  1. Close! Let us now look at the details of the output object we just received, using the Get-Member cmdlet on the output of Get-Item.
PS> Get-Item '/home/ram' | Get-Member
Get-Member shows all the members available in the output object (most PowerShell cmdlets return objects as output, not plain text). For more information, run Get-Help Get-Member.

This would list a series of members that are part of the output. We're primarily concerned about the very first line for now.

PS> Get-Item '/home/ram' | Get-Member

TypeName: System.IO.DirectoryInfo

Name MemberType Definition
---- ---------- ----------
LinkType CodeProperty System.String LinkType{get=GetLinkType;}
Mode CodeProperty System.String Mode{get=Mode;}
.
.
.
..................Content has been hidden....................

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