Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
New-Object creates an instance of a Microsoft .NET Framework object. In this section, I’ll “new” up a component object model (COM) object and launch Internet Explorer, and then I’ll new up a native PowerShell object, PSObject, and add properties to it. I’ll then show the streamlined PowerShell v3 syntax, and finally, I’ll work with a .NET Framework object.
Here, in three lines of PowerShell, I can create a COM object, call a method on it, and set a property. I don’t know how many lines are needed to get this done in C#. Remember the ProgID? That is how we used to interact with COM objects. Here, I am using the ProgID InternetExplorer.Application; then I’m navigating to the Google page and making IE visible. If you’ve got a ProgID, PowerShell can make short work of it.