Created
November 14, 2019 08:31
-
-
Save sub314xxl/8571131f21bfbf1bef2531ec75185a8c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-ComObject { | |
param( | |
[Parameter(Mandatory=$true, | |
ParameterSetName='FilterByName')] | |
[string]$Filter, | |
[Parameter(Mandatory=$true, | |
ParameterSetName='ListAllComObjects')] | |
[switch]$ListAll | |
) | |
$ListofObjects = Get-ChildItem HKLM:\Software\Classes -ErrorAction SilentlyContinue | Where-Object { | |
$_.PSChildName -match '^\w+\.\w+$' -and (Test-Path -Path "$($_.PSPath)\CLSID") | |
} | Select-Object -ExpandProperty PSChildName | |
if ($Filter) { | |
$ListofObjects | Where-Object {$_ -like $Filter} | |
} else { | |
$ListofObjects | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment