First, we will look at converting text into an object from a plain text input at the Terminal. This involves using what is known as a PowerShell Type Accelerator. A PowerShell Type Accelerator is an alias for .NET classes. Using these, we can call .NET classes and use many of their functionalities within PowerShell:
- Let's take plain text as input and convert the text into a date object. To check what sort of object your input is, use the Get-Member cmdlet:
PS> '21 June 2018' | Get-Member
- The TypeName says System.String. This confirms that what we entered was plain text. Now, let's ...