How it works...

Using the properties and methods within a returned object is simple. Objects from within the output returned by a cmdlet can be called using the member access operator directly on the command (cmdlet including the parameter).

Calling properties after the member access operator fetches the data that's held within the property. In our case, it was the LastWriteTime.

Methods are functions. They may or may not require an argument. The CreateSubdirectory method requires a string argument, which is the name (or path) of the sub-directory we wish to create—whatever we enter in the parenthesis essentially forms the path we wish to create. In case of methods that can run without an argument, they need to be called with empty parenthesis following the name of the method, like ToString(), for example.

When we pass the string argument into CreateSubdirectory, the method runs a .NET Core routine and creates a sub-directory within the directory we specify with Get-Item. The internal workings of the .NET Core is beyond the scope of this book.

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

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