Use a COM Object
1. Problem
You want to create a COM object to interact with its methods and properties.
2. Solution
Use the New-Object cmdlet (with the –ComObject parameter) to create a COM object from its ProgID. You can then interact with the methods and properties of the COM object as you would any other object in PowerShell.
       $object = New-Object -ComObject ProgId
For example:
       PS >$sapi = New-Object -Com Sapi.SpVoice
       PS >$sapi.Speak("Hello World")
3. Discussion
Historically, many applications have exposed their scripting and administration inter-faces as COM objects. While .NET APIs (and PowerShell cmdlets) are becoming more common, interacting with COM objects is still a common administrative task.
Tags: cmd, cmdlet, com, net, object, objects
