Public/Get-ComObject.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
function Get-ComObject { [CmdletBinding()] param( [string[]]$Filter ) $ListofObjects = Get-ChildItem -Path 'registry::HKEY_CLASSES_ROOT\' -ErrorAction SilentlyContinue | Where-Object { $_.PSChildName -match '^\w+\.\w+$' -and (Test-Path -Path ('{0}\CLSID' -f $_.PSPath)) } | Select-Object -ExpandProperty PSChildName if ($Filter) { $ListofObjects | Where-Object {$_ -match ($Filter -join '|')} } else { $ListofObjects } } |