Skip to content

How to be able to use WMI with 'root\default' namespace? Is this a limitation of the framework? #4286

Discussion options

You must be logged in to vote

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:

using System.Management;

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            ManagementScope scope = new(@"root\DEFAULT");
            ManagementPath path = new("SystemRestore");
            ManagementClass mClass = new(scope, path, new ObjectGetOptions());
            var restorePoints = mClass.GetInstances().Count;

     …

Replies: 2 comments 13 replies

Comment options

You must be logged in to vote
5 replies
@bogdan-patraucean
Comment options

@ghost1372
Comment options

@bogdan-patraucean
Comment options

@ghost1372
Comment options

@bogdan-patraucean
Comment options

Comment options

You must be logged in to vote
8 replies
@bogdan-patraucean
Comment options

@DarranRowe
Comment options

@bogdan-patraucean
Comment options

@DarranRowe
Comment options

Answer selected by bogdan-patraucean
@bogdan-patraucean
Comment options

@DarranRowe
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants