Skip to content

Instantly share code, notes, and snippets.

@mattifestation
Created July 13, 2015 00:17
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mattifestation/2727b6274e4024fd2481 to your computer and use it in GitHub Desktop.
Save mattifestation/2727b6274e4024fd2481 to your computer and use it in GitHub Desktop.
Crappy script that enumerates installed WMI providers
# Author: Matt Graeber (@mattifestation)
New-PSDrive -PSProvider Registry -Root HKEY_CLASSES_ROOT -Name HKCR
function Get-WmiNamespace {
Param (
$Namespace='ROOT'
)
Get-WmiObject -Namespace $Namespace -Class __NAMESPACE | ForEach-Object {
($ns = '{0}\{1}' -f $_.__NAMESPACE,$_.Name)
Get-WmiNamespace $ns | ? { -not $_.ToLower().EndsWith('\ms_409') }
# ms_409 only refers to EN_US CIM repositories
}
}
Get-WmiNamespace | % {
Get-WmiObject -Class __Provider -Namespace $_ | % {
$ProviderInfo = [Ordered] @{
Namespace = $_.__NAMESPACE
ProviderName = $_.Name
CLSID = $_.CLSID
}
$DLL = ''
if ($_.CLSID) {
$DLL = Get-ItemProperty -Path "HKCR:\CLSID\$($_.CLSID)\InprocServer32" -ErrorAction SilentlyContinue |
Select-Object -ExpandProperty '(default)'
}
$ProviderInfo['Dll'] = $DLL
New-Object PSObject -Property $ProviderInfo
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment