1 / 1 / 0 Регистрация: 09.01.2011 Сообщений: 37 |
|
1 |
|
01.02.2011, 15:09. Показов 20627. Ответов 1
Я в этой теме новичёк Подскажите кто знает где этот список можно увидеть, кроме как в реестре
0 |
17 / 17 / 0 Регистрация: 19.02.2012 Сообщений: 68 |
|
29.06.2012, 10:53 |
2 |
Посмотреть все компоненты можно: Можно не только просмотреть но и настроить Добавлено через 1 минуту
2 |
от Qlik Expert Russia
Получить список COM объектов из PowerShell Windows
Для 1С Предприятие 8.3 в Windows 10 есть следующие объекты:
- V83.Application
- V83C.Application
Получение перечня всех ComObject в Windows (Команда PowerShell)
- Открыть Windows PowerShell ISE
- Запустить код:
1 |
gci HKLM:\Software\Classes —ea 0| ? {$_.PSChildName —match ‘^\w+\.\w+$’ —and (gp «$($_.PSPath)\CLSID» —ea 0)} | ft PSChildName |
0
0
голос
Рейтинг статьи
Related posts:
- PowerShell и QlikView 12. Книги по PowerShell. Примеры и практика.
- Обзор модуля Аналитика – Управление нашей фирмой 1С Предприятие 8.3
- Программирование в 1С:Предприятие 8.3 Внешняя обработка Программный модуль
- Концепция системы 1С:Предприятие 7.7. Метаданные, Основные понятия
Подписаться
Уведомить о
1 Комментарий
Старые
Новые
Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
Ness
4 лет назад
Спасибо. Помогло.
0
Ответить
In Powershell I can create COM objects which can be used, 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?
- com
- powershell
asked Mar 18, 2009 at 22:15
John ChanningJohn Channing
6,5117 gold badges46 silver badges56 bronze badges
3 Answers
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
let us know if it works!
answered Mar 18, 2009 at 22:37
Jeff AtwoodJeff Atwood
63.4k48 gold badges150 silver badges153 bronze badges
6
-
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.
Mar 19, 2009 at 13:44
-
my two cents:
HKLM\Software\Classes
actually corresponds toHKCR
May 6, 2011 at 20:59
-
And my two cents: rather than piping to
ft PSChildName
, pipe toselect -ExpandProperty PSChildName
. That returns the results as an array that can be filtered with -match or Select-String.Aug 2, 2014 at 18:06
-
wben you do
Format-Text
, you will not getstring
s, but some formatting related classesAug 9, 2019 at 10:24
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».
answered Mar 19, 2009 at 6:12
dan-gphdan-gph
16.4k12 gold badges61 silver badges80 bronze badges
1
Another option that should be noted is through WMI:
Get-WMIObject Win32_ClassicCOMClassSetting
answered Mar 24, 2009 at 21:56
JasonMArcherJasonMArcher
14.3k22 gold badges56 silver badges52 bronze badges
4
-
running this produced an infinite loop
Jun 19, 2009 at 18:33
-
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.
Jun 27, 2009 at 22:45
-
That does not list the ActiveX control I am looking for. This does gist.github.com/810398
May 11, 2011 at 21:49
-
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.
Aug 31, 2015 at 3:21
Let’s see what WMI can tell us about COM objects on the system.
Get a list of all WMI classes with the word “COM” in them (doing a case sensitive match to avoid entries like “computer”).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
PS> gwmi -list | ?{ $_.Name -cmatch «COM» } NameSpace: ROOT\cimv2 Name Methods Properties —— ———— ————— MSFT_WMI_GenericNonCOMEvent {} {ProcessId, PropertyNames, PropertyValues, ProviderName...} Win32_COMApplication {} {Caption, Description, InstallDate, Name...} Win32_DCOMApplication {} {AppID, Caption, Description, InstallDate...} Win32_COMClass {} {Caption, Description, InstallDate, Name...} Win32_ClassicCOMClass {} {Caption, ComponentId, Description, InstallDate...} Win32_COMSetting {} {Caption, Description, SettingID} Win32_ClassicCOMClassSetting {} {AppID, AutoConvertToClsid, AutoTreatAsClsid, Caption...} Win32_DCOMApplicationSetting {GetLaunchSecurit... {AppID, AuthenticationLevel, Caption, CustomSurrogate...} Win32_ClassicCOMClassSettings {} {Element, Setting} Win32_COMApplicationSettings {} {Element, Setting} Win32_DCOMApplicationAccessAllow... {} {Element, Setting} Win32_COMApplicationClasses {} {GroupComponent, PartComponent} Win32_ClassicCOMApplicationClasses {} {GroupComponent, PartComponent} Win32_DCOMApplicationLaunchAllow... {} {Element, Setting} |
Win32_COMApplication
gives me about 386 results. It includes the AppID
of the application associated with the COM object.
I am not a programmer so I won’t be going further into AppID
s and such, but it’s worth knowing about this and related COM terminology so here’s a quick rundown:
- All COM objects have a
CLSID
which is basically a 128-bit hexadecimal Globally Unique IDentifier (GUID) for the COM object. This way COM objects can be referred to independent of their installation path. The CLSID is unique across network computers too (relevant, when used with DCOM).WMI objects refer to this as
ComponentID
. They can also be found in the registry underHKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID
. For example, theCLSID
for WordPad is{73FDDC80-AEA9-101A-98A7-00AA00374959}
CLSID
s are not easy to remember, and sometimes COM objects with differentCLSID
s can be used interchangeably (for instance: different versions of Internet Explorer will have differentCLSID
s but you need some way of referring to the Internet Explorer COM object such that whatever version is installed on the system is used). For this reason you haveProgID
s (Programmatic IDentifier).ProgID
s can be found in the registry underHKEY_LOCAL_MACHINE\SOFTWARE\Classes
. The format of a ProgID is<Program>.<Component>.<Version>
, separated by periods and with no spaces. For example, theProgID
for WordPad isWordPad.Document.1
.PowerShell’s
New-Object
cmdlet usesProgID
when creating new objects that refer to COM objects soProgID
s are relevant to us.PS> help New-Object -Parameter ComObject
-ComObject <String>
Specifies the programmatic identifier (ProgID) of the COM object.
Required? true
Position? 1
Default value None
Accept pipeline input? false
Accept wildcard characters? false
- While not relevant to the current topic, there’s also an
AppID
which is yet another 128-bit hexadecimal GUID. You can read more about it here.
Now let’s get a list of how many objects are returned by each WMI class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
PS> gwmi -list | ?{ $_.Name -cmatch «COM» } | ft Name,@{Name=«Number of objects»;Expr={(gwmi $_.Name | Measure-Object -Line).Lines}} -AutoSize Name Number of objects —— ————————— MSFT_WMI_GenericNonCOMEvent 0 Win32_COMApplication 397 Win32_DCOMApplication 397 Win32_COMClass 5721 Win32_ClassicCOMClass 5721 Win32_COMSetting 6118 Win32_ClassicCOMClassSetting 5721 Win32_DCOMApplicationSetting 397 Win32_ClassicCOMClassSettings 5721 Win32_COMApplicationSettings 397 Win32_DCOMApplicationAccessAllowedSetting 526 Win32_COMApplicationClasses 579 Win32_ClassicCOMApplicationClasses 579 Win32_DCOMApplicationLaunchAllowedSetting 491 |
The biggest results are from the Win32_COMSetting
class. Let’s compare the results of this with the Win32_ClassicCOMClassSetting
class (which has the second largest number of results) to see what’s different. Since the ProgID
property is what’s relevant to PowerShell, let’s filter the results to objects where ProgID
is not $null
.
# store the results from each class in a variable; filter out ones where ProgID is $null PS> $COMClassicSet = gwmi Win32_ClassicCOMClassSetting | ?{ $_.ProgId -ne $null } | Sort-Object PS> $COMSet = gwmi Win32_COMSetting | ?{ $_.ProgId -ne $null } | Sort-Object PS> Compare-Object $COMSet $COMClassicSet PS> |
There’s no difference. So in terms of ProgID
both classes contain the same number of objects. Now let’s recreate the above table to only consider results where ProgID
is not $null
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
PS> gwmi -list | ?{ $_.Name -cmatch «COM» } | ft Name,@{Name=«Number of objects»;Expr={(gwmi $_.Name | ?{ $_.ProgID -ne $null } | Measure-Object -Line).Lines}} -AutoSize Name Number of objects —— ————————— MSFT_WMI_GenericNonCOMEvent 0 Win32_COMApplication 0 Win32_DCOMApplication 0 Win32_COMClass 0 Win32_ClassicCOMClass 0 Win32_COMSetting 1613 Win32_ClassicCOMClassSetting 1613 Win32_DCOMApplicationSetting 0 Win32_ClassicCOMClassSettings 0 Win32_COMApplicationSettings 0 Win32_DCOMApplicationAccessAllowedSetting 0 Win32_COMApplicationClasses 0 Win32_ClassicCOMApplicationClasses 0 Win32_DCOMApplicationLaunchAllowedSetting 0 |
The interesting thing to note is that all the other classes have 0 objects now. In fact, we can see that the number of objects returned by the Win32_COMSetting
class is equal to the number returned by Win32_ClassicCOMClassSetting
plus Win32_COMApplication
or Win32_DCOMApplication
or Win32_DCOMApplicationSetting
or Win32_COMApplicationSettings
. Something to investigate later?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
PS C:\Users\rakhesh\Code> gwmi -list | ?{ $_.Name -cmatch «COM» } | ft Name,@{Name=«Number of objects»;Expr={(gwmi $_.Name | Measure-Object -Line).Lines}} -AutoSize Name Number of objects —— ————————— MSFT_WMI_GenericNonCOMEvent 0 Win32_COMApplication 397 Win32_DCOMApplication 397 Win32_COMClass 5721 Win32_ClassicCOMClass 5721 Win32_COMSetting 6118 Win32_ClassicCOMClassSetting 5721 Win32_DCOMApplicationSetting 397 Win32_ClassicCOMClassSettings 5721 Win32_COMApplicationSettings 397 Win32_DCOMApplicationAccessAllowedSetting 526 Win32_COMApplicationClasses 579 Win32_ClassicCOMApplicationClasses 579 Win32_DCOMApplicationLaunchAllowedSetting 491 |
So, the best way to get COM objects via WMI & PowerShell is to use the Win32_COMSetting
class. And to get the ProgID
or any application (such as Internet Explorer in the previous post) something along the following lines will do:
PS> gwmi Win32_COMSetting | ?{ $_.ProgId -match «Internet» } | ft ProgId,Caption ProgId Caption ——— ———— InternetExplorer.Application.1 Internet Explorer(Ver 1.0) Internet.HHCtrl.1 HHCtrl Object Internet.HHCtrl.1 HHCtrl Object Internet.HHCtrl.1 HHCtrl Object InternetShortcut Internet Shortcut |
If there’s only one version, the version number can be skipped in ProgID
which is why InternetExplorer.Application
too works.
Update: In fact, only the Win32_COMSetting
and Win32_ClassicCOMClassSetting
classes contain ProgID
in their output. So these are the only two classes one can use. And since the only difference them is that Win32_COMSetting
contains objects without any ProgID
(of no use in our case!) it’s ok to use either class.
PS> gwmi -list | ?{ $_.Name -cmatch «^Win32.*COM» } | ?{ @(gwmi $_.Name | gm -MemberType Property | select -Unique -Expand Name).Contains(«ProgId») } NameSpace: ROOT\cimv2 Name Methods Properties —— ———— ————— Win32_COMSetting {} {Caption, Description, SettingID} Win32_ClassicCOMClassSetting {} {AppID, AutoConvertToClsid, AutoTreatAsClsid, Caption...} |
Update2: Turns out WMI is not a good way to get the list of COM objects. A better approach is to query the registry. See my next post.
- Remove From My Forums
-
Question
-
In a very old post ( http://www.vistax64.com/powershell/91583-there-any-script-get-list-com-objects-computer.html ) I’ve found a solution to list every COM objects in a computer
These 2 solutions were posted:
1) gci HKLM:\Software\Classes -ea 0| ? {$_.PSChildName -match ‘^\w+\.\w+$’ -and (gp «$($_.PSPath)\CLSID» -ea 0)} | ft PSChildName
and a much simpler one:
2) get-wmiobject Win32_COMClass
The first one is great because it returns the PSchildname that I can use in $xl = new-object -comobject <PSCHILDNAME>
The second one is definitely shorter, and is the one I would like to use, but so far I cannot find the PSChildname in the form xxxxxxx.yyyyyyy like $xl = new-object -comobject excel.application
Any thoughts ?
Answers
-
Hi Cyreli,
The first command doesn’t actually return every Com Class, just those where the ProgID matches the pattern of
<letters>.<letters>.The Win32_ComClass doesn’t directly contain the ProgID of any of the classes, so by the time you cross reference with the values contained within win32_classiccomclasssetting you wind up with an extremely slow executing query.
What you could always do is place a function such as the one detailed by James Brundage here(
http://blogs.msdn.com/b/powershell/archive/2009/03/20/get-progid.aspx) into your powershell profile so that it’s always availible. The execution time is fine
and it takes 64-Bit computing into account (which is always nice…)function Get-ProgID { #.Synopsis # Gets all of the ProgIDs registered on a system #.Description # Gets all ProgIDs registered on the system. The ProgIDs returned can be used with New-Object -comObject #.Example # Get-ProgID #.Example # Get-ProgID | Where-Object { $_.ProgID -like "*Image*" } param() $paths = @("REGISTRY::HKEY_CLASSES_ROOT\CLSID") if ($env:Processor_Architecture -eq "amd64") { $paths+="REGISTRY::HKEY_CLASSES_ROOT\Wow6432Node\CLSID" } Get-ChildItem $paths -include VersionIndependentPROGID -recurse | Select-Object @{ Name='ProgID' Expression={$_.GetValue("")} }, @{ Name='32Bit' Expression={ if ($env:Processor_Architecture -eq "amd64") { $_.PSPath.Contains("Wow6432Node") } else { $true } } } }
If you haven’t done so already, the below two lines will create a profile for you..
new-item ($PROFILE -replace "\\[^\\]*ps1$") -ItemType directory notepad $PROFILE
Then just paste in the function definition into your profile, restart powershell and voila, done.
You could of course do the exact same thing with the code from your source article (as a note, if you do, i’d replace the call to format-table at the end with a select. That way you can send the results of your function off down the pipeline without
too many problems, as formatting cmdlets should only really be at the end of a pipeline).Hope that Helps,
Matthew
-
Marked as answer by
Thursday, September 16, 2010 10:24 AM
-
Marked as answer by