I am currently usi开发者_运维百科ng the following script to list the available COM Objects on my machine.
$path = "REGISTRY::HKEY_CLASSES_ROOT\CLSID\*\PROGID"
foreach ($obj in dir $path) {
write-host $obj.GetValue("")
}
I read on another website that the existence of the InProcServer32 key is evidence that the object is 64 bit compatible.
So using powershell how can I determine the existence of InProcServer32 for each COM Object? If that is even the correct way of establishing whether it is 32 bit or 64 bit.
I don't know whether that is the way to determine 64-bit compatibility but the way to see if a regkey exists is to use Test-Path e.g.:
PS> Test-Path HKLM:\SOFTWARE
True
PS> Test-Path HKLM:\SOFTWARE2
False
In your case:
$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
}
}
精彩评论