Working with .NET objects
In Chapter 1, Getting Started with Windows PowerShell, we discussed the relation between Windows PowerShell and the .NET framework, and we saw how .NET is adapted in PowerShell in different examples. In this section of this chapter, we will be working intensely with .NET objects in PowerShell.
Creating .NET objects
In order to create a new .NET object, we usually use the
New-Object cmdlet that it is similar to the
new operator in languages such as C#. Yes, I said usually because you might use casting to convert a PowerShell object to a .NET object as seen in Chapter 1, Getting Started with Windows PowerShell. The
New‑Object cmdlet is used to create .NET objects and COM objects, but the parameters are different in the case ...