PowerShell Core for Linux Administrators Cookbook
上QQ阅读APP看书,第一时间看更新

How to do it…

  1. With PowerShell, .NET Core is also installed as a dependency. Let's create an object in PowerShell that will call a .NET class and its default constructor. This constructor requires an argument:
PS> New-Object -TypeName System.IO.DirectoryInfo -ArgumentList $HOME

Here, /home/ram is my home directory. Replace this path with yours.

  1. Use the Get-Item cmdlet with the same argument as before, and see what you get:
PS> Get-Item $HOME
  1. Close! Now, let's look at the members of the output object we just received by using Get-Member:
PS> Get-Item $HOME | Get-Member

This will list a series of members (properties, methods) that are part of the output. We're primarily concerned about the very first line for now.