Skip to content

Instantly share code, notes, and snippets.

@itpropro
Created September 28, 2016 08:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save itpropro/142b07b0258dfdf8817e2e290d2764f0 to your computer and use it in GitHub Desktop.
Save itpropro/142b07b0258dfdf8817e2e290d2764f0 to your computer and use it in GitHub Desktop.
function Get-AvailableComObjects {
$classesCom = ''
$classes = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey('SOFTWARE\\Classes').GetSubKeyNames()
[regex]::Matches($classes, '\w+\.\w+').Value | % {if ([Microsoft.Win32.Registry]::LocalMachine.OpenSubKey("SOFTWARE\\Classes\\$_\\CLSID")) {$classesCom += "$_`r`n"}}
$classesCom.Replace("`r`n",' ').Split(' ') | Select-Object -Unique
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment