Skip to content

Instantly share code, notes, and snippets.

@opexxx
Forked from itpropro/Get-AvailableComObjects.ps1
Created October 29, 2016 00:23
Show Gist options
  • Select an option

  • Save opexxx/ae65097eb7e709b50ef28f1227d3fd72 to your computer and use it in GitHub Desktop.

Select an option

Save opexxx/ae65097eb7e709b50ef28f1227d3fd72 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