Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Powershell列出可用的COM对象_Powershell_Com Object - Fatal编程技术网

使用Powershell列出可用的COM对象

使用Powershell列出可用的COM对象,powershell,com-object,Powershell,Com Object,我目前正在使用以下脚本列出我机器上可用的COM对象 $path = "REGISTRY::HKEY_CLASSES_ROOT\CLSID\*\PROGID" foreach ($obj in dir $path) { write-host $obj.GetValue("") } 我在另一个网站上读到,InProcServer32键的存在证明该对象是64位兼容的 因此,使用powershell如何确定每个COM对象是否存在InProcServer32?如果这是确定它是32位还是64位的正

我目前正在使用以下脚本列出我机器上可用的COM对象

$path = "REGISTRY::HKEY_CLASSES_ROOT\CLSID\*\PROGID"
foreach ($obj in dir $path) {
    write-host $obj.GetValue("")
}
我在另一个网站上读到,InProcServer32键的存在证明该对象是64位兼容的


因此,使用powershell如何确定每个COM对象是否存在InProcServer32?如果这是确定它是32位还是64位的正确方法。

我不知道这是否是确定64位兼容性的方法,但查看regkey是否存在的方法是使用测试路径,例如:

PS> Test-Path HKLM:\SOFTWARE
True
PS> Test-Path HKLM:\SOFTWARE2
False
就你而言:

$path = "REGISTRY::HKEY_CLASSES_ROOT\CLSID\*\PROGID" 
foreach ($obj in dir $path) { 
    write-host $obj.GetValue("") 
    if (Test-Path (Join-Path $obj.PSParentPath 'InprocServer32'))
    {
        # key exists
    }
}