49

COM objects can be created and used in PowerShell, for example to control Microsoft Office applications:

$excel = New-Object -com "Excel.Application"
$excel.visible = $true

How can I list all of the available COM objects that can be created in PowerShell?

3 Answers 3

80

I found this PowerShell one-liner script that supposedly lists all COM objects.

gci HKLM:\Software\Classes -ea 0| ? {$_.PSChildName -match '^\w+\.\w+$' -and
(gp "$($_.PSPath)\CLSID" -ea 0)} | ft PSChildName
Sign up to request clarification or add additional context in comments.

7 Comments

I can confirm that it does list all the registered COM objects. Whether or not they implement the COM interface correctly is a whole different issue. :)
my two cents: HKLM\Software\Classesactually corresponds to HKCR
And my two cents: rather than piping to ft PSChildName, pipe to select -ExpandProperty PSChildName. That returns the results as an array that can be filtered with -match or Select-String.
this script above did not work for me, instead this script works: powershellmagazine.com/2013/06/27/…
wben you do Format-Text, you will not get strings, but some formatting related classes
|
9

Use OleView.exe from Microsoft. I think it may come with Visual Studio. If not, you can find it in the Windows SDK. That's a big download; you can either download the whole thing or you could experiment with downloading it piecemeal using the setup.exe installer.

Once in OleView, look under "type libraries". Excel for instance appears under "Microsoft Exel".

1 Comment

7

Another option that should be noted is through WMI:

Get-WMIObject Win32_ClassicCOMClassSetting

4 Comments

running this produced an infinite loop
Since it isn't a loop, it can not possibly be an infinite loop. It will take a long time to run because there are MANY COM components.
That does not list the ActiveX control I am looking for. This does gist.github.com/810398
ActiveX Controls won't always have a progid, or more correctly, a programmatic identifier (which is what the scripts above are discovering in HKCR. But they always have a CLSID. If you are just trying to determine whether the ActiveX Control is installed so you can uninstall it, search for its CLSID in HKCR/CLSID.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.