none
[UWF] [WIN10 LTSB] Not able to create a UWF_VOLUME instance RRS feed

  • Question

  • Hello.

    I am creating a small helper program that will apply the right UWF configurations.

    A part of it is to protect the C:/ drive.

    Now with a fresh install there is only one UWF_Volume instance, which is for the current session. uwfmgr.exe volume protect c: creates the instance.

    The docs hint at creating the UWF_Volume instance yourself, but i was not able to do this.

    I used Mgmtclassgen.exe to generate strongly typed wmi classes, and i then tried the following code:

                string CreatedWmiNamespace = "ROOT\\StandardCimv2\\embedded";
                string CreatedClassName = "UWF_Volume";
    
                var managementScope = new ManagementScope();
                managementScope.Path.NamespacePath = CreatedWmiNamespace;
                managementScope.Path.Server = Environment.UserDomainName;
                managementScope.Path.RelativePath = "UWF_Volume.CurrentSession=false,DriveLetter=\"C:\",VolumeName=\"Volume{61f048ac-d2e8-48b3-973d-1d14ac35c409}\"";
                var managementPath = new ManagementPath(CreatedClassName);
    
                var managementClass = new ManagementClass(managementScope, managementPath, null);
                
                var mgtmObject = managementClass.CreateInstance();
                
                var putoptions = new PutOptions();
                putoptions.Type = PutType.UpdateOrCreate;
    
                mgtmObject.Put(putoptions);

    Both the strongly typed class and this give an exception:

    System.Management.ManagementException was unhandled
      HResult=-2146233087
      Message=Invalid parameter 
      Source=System.Management
    
    

    How can I create the UWF_Volume instance correctly?


    

    Wednesday, October 17, 2018 2:21 PM

All replies

  • Since there is multiple sessions with UWF, a foreach is needed to get the correct instance. There is a UWF C# source code example that comes with my book: http://www.annabooks.com/Book_SGWin10IoTE.html. Please look at the downloads. 

    Sean Liming - Book Author: Starter Guide Windows 10 IoT Enterprise - www.annabooks.com / www.seanliming.com

    Thursday, October 18, 2018 3:11 AM
    Moderator