O'Reilly logo

Windows PowerShell™ 2.0: Administrator’s Pocket Consultant by William R. Stanek

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with COM and .NET Framework Objects

The Component Object Model (COM) and the .NET Framework are two object models you’ll work with frequently in PowerShell. Although many applications provide scripting and administrative objects through COM, .NET Framework and even PowerShell cmdlets are becoming increasingly prevalent.

Creating and Using COM Objects

You can create instances of COM objects using the New-Object cmdlet. The basic syntax is

New-Object [-Set AssocArray] [-Strict] [-ComObject] String

When creating the object, set the –ComObject parameter to the object’s programmatic identifier (ProgID). Most well-known COM objects can be used within PowerShell, including those for Windows Script Host (WSH). The following example creates a shortcut ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required