1

I'm trying to query classes in the root\microsoft\windows\managementtools namespace, but am getting an odd error. I have confirmed this namespace exists on my machine, because I can query it using WMIExplorer. Here is the error:

C:\> Get-WmiObject -Namespace ROOT\Microsoft\Windows\ManagementTools -Query "SELECT * FROM MSFT_MTRegistryKey"
Get-WmiObject : Not supported
At line:1 chat:1 ...

I am running this local to the Windows 2016 server and through an Administrator powershell. I confirmed the Administrator group has all accesses in the WMI security tab.

1 Answers1

1

Considering that the GetKey method of that class returns an object of the same class, I don't think you can query it in this way. What you are effectively doing is getting an instance of every single key in the entire registry of the local computer. This site claims that number would be in the millions.

Perhaps you want to try

Invoke-WmiMethod -Namespace root\microsoft\windows\managementtools -Class MSFT_MTRegistryKey -Name GetKey -ArgumentList '<name of key>'

On the return object you can then call GetSubKeys or GetValues on its Result property.

Incidentally, there is also the StdRegProv class for querying the registry with WMI/CIM.

A J Wilson
  • 353
  • 2
  • 10