Почему у меня есть класс WMI, но нет экземпляра? - PullRequest
0 голосов
/ 09 июля 2020

Я следую руководству Microsoft по настройке собственного поставщика WMI. После регистрации моего провайдера в Register-CimProvider.exe я вижу класс: Get-CimClass -Namespace root / StandardCimv2 / sample -ClassName MSFT_WindowsProcess

   NameSpace: ROOT/StandardCimv2/sample

CimClassName                        CimClassMethods      CimClassProperties
------------                        ---------------      ------------------
MSFT_WindowsProcess                 {RequestStateChan... {Caption, Description, ElementName, InstanceID...}

Однако в следующем экземпляре этого класса нет. сбой команды:

Get-CimInstance -ClassName MSFT_WindowsProcess -Namespace root/StandardCimv2/sample
Get-CimInstance : Provider load failure
At line:1 char:1
+ Get-CimInstance -ClassName MSFT_WindowsProcess -Namespace root/Standa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (root/StandardCi..._WindowsProcess:String) [Get-CimInstance], CimException
    + FullyQualifiedErrorId : HRESULT 0x80041013,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand

Это мой mof:

#pragma include ("cim_schema_2.26.0.mof")
#pragma include ("MSFT_Qualifiers.mof")

// MSFT_WindowsProcess class derives from CIM_Process class,
// which defines the schema for the processes running on windows OS.
[ClassVersion("1.0.0")]
class MSFT_WindowsProcess : CIM_Process
{
 string CommandLine;

 [Description("This instance method demonstrates modifying the "
  "priority of a given process."
  "The method returns an integer value of 0 if the "
  "operation was successfully completed,"
  "and any other number to indicate an win32 error code.")]
 uint32 SetPriority([In] uint32 Priority);

 [static,
 Description("This static method demonstrates creating a process "
  "by supplying commandline to start a new process."
  "It will output the reference to the newly created process."
  "The method returns an integer value of 0 if the process "
  "was successfully created, and any other number to "
  "indicate an win32 error code.")]
 uint32 Create([In] string CommandLine, [Out] CIM_Process ref Process);
};

Я выполнил все остальные шаги в руководстве.

Что мне нужно сделать, чтобы создать экземпляр класса?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...