How it works...

Notice the very first line of the output, TypeName: System.IO.DirectoryInfo. That is the exact type name we used when creating the .NET object.

This proves that the same task of showing information on the current working directory can be achieved by calling a .NET constructor, or by running a PowerShell cmdlet. Therefore, we infer that PowerShell cmdlets are simply encapsulated .NET code, simplified to enable administrators to work with computers, without having to worry about the underlying .NET code.

In essence, Get-Item calls the System.IO.DirectoryInfo class under the hood, with the arguments passed along with the cmdlet.

Get-Item can be used with any location in your file system. As long as you are authorised to access the location, PowerShell would return information about the location you pass as the argument.

Like they say:

If the C# guys can do it, so can you.

..................Content has been hidden....................

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