September 2012
Intermediate to advanced
1680 pages
88h 3m
English
The New-Object cmdlet is used to create both .NET and COM objects. To create an instance of a .NET object, you just provide the fully qualified name of the .NET class you want to use, as shown here:
PS C:\> $Ping = new-object Net.NetworkInformation.Ping
By using the New-Object cmdlet, you now have an instance of the Ping class that enables you to detect whether a remote computer can be reached via Internet Control Message Protocol (ICMP). Therefore, you have an object-based version of the Ping.exe command-line tool.
To an instance of a COM object, the comObject parameter is used. To use this parameter, define its argument as the COM object’s programmatic identifier (ProgID), as shown here:
PS C:\> $IE = new-object ...
Read now
Unlock full access