-
-
Save mattifestation/2727b6274e4024fd2481 to your computer and use it in GitHub Desktop.
Crappy script that enumerates installed WMI providers
This file contains 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
# 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