How to be able to use WMI with 'root\default' namespace? Is this a limitation of the framework? #4286
-
This piece of code works perfectly in a console app, but fails on a WinAppSdk project (both packaged and unpackaged) with the following exception: Some relevant info:
Here is the sample in case you want to debug or something: System Restore points.zip |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 13 replies
-
It seems that this code does not have the access but, you can use elevated mode (Run as Admin) which works fine |
Beta Was this translation helpful? Give feedback.
-
HRESULT 0x80040154 is REGDB_E_CLASSNOTREG. --Edit-- |
Beta Was this translation helpful? Give feedback.
Well, I took the Windows App SDK completely out of the equation and used the code in your original post in a simple console application. It only referenced the System.Management package. I packaged this up using a C# application packaging project and it fails with the exact same error.
This was using: