为什么wmi进程win32_xxx查询比cim_xxx查询更快?

时间:2022-02-14 19:20:20

PS D:\work\scripts> measure-command { get-wmiobject -query "select * from win32_service" | Where-Object -FilterScript {$ _.Name -eq "WinRM"} }

PS D:\ work \ scripts> measure-command {get-wmiobject -query“select * from win32_service”| Where-Object -FilterScript {$ _.Name -eq“WinRM”}}

Days : 0 Hours : 0 Minutes : 0 Seconds : 0 Milliseconds : 426 Ticks : 4262955 TotalDays : 4.93397569444444E-06 TotalHours : 0.000118415416666667 TotalMinutes : 0.007104925 TotalSeconds : 0.4262955 TotalMilliseconds : 426.2955

天:0小时:0分钟:0秒:0毫秒:426蜱:4262955总时间:4.93397569444444E-06 TotalHours:0.000118415416666667总分:0.007104925总分:0.4262955总百分比:426.2955

PS D:\work\scripts> measure-command { get-wmiobject -query "select * from cim_service" | Where-Object -FilterScript {$_. Name -eq "WinRM"} }

PS D:\ work \ scripts> measure-command {get-wmiobject -query“select * from cim_service”| Where-Object -FilterScript {$ _。名称-eq“WinRM”}}

Days : 0 Hours : 0 Minutes : 1 Seconds : 35 Milliseconds : 320 Ticks : 953208058 TotalDays : 0.00110325006712963 TotalHours : 0.0264780016111111 TotalMinutes : 1.58868009666667 TotalSeconds : 95.3208058 TotalMilliseconds : 95320.8058

天:0小时:0分钟:1秒:35毫秒:320蜱:953208058总时间:0.00110325006712963总时数:0.0264780016111111总分:1.58868009666667总分:95.3208058总百分比:95320.8058

1 个解决方案

#1


it is simple - by querying CIM_Service you retrieve more information (as CIM services are not limited by Win32 services; moreover win32_service instances are contained within CIM_Service). That is - your queries differ significantly in the amount of data retrieved.

它很简单 - 通过查询CIM_Service可以检索更多信息(因为CIM服务不受Win32服务的限制;而且win32_service实例包含在CIM_Service中)。也就是说 - 您的查询在检索的数据量方面存在显着差异。

You can easily explore it via WMI CIM Studio.

您可以通过WMI CIM Studio轻松浏览它。

#1


it is simple - by querying CIM_Service you retrieve more information (as CIM services are not limited by Win32 services; moreover win32_service instances are contained within CIM_Service). That is - your queries differ significantly in the amount of data retrieved.

它很简单 - 通过查询CIM_Service可以检索更多信息(因为CIM服务不受Win32服务的限制;而且win32_service实例包含在CIM_Service中)。也就是说 - 您的查询在检索的数据量方面存在显着差异。

You can easily explore it via WMI CIM Studio.

您可以通过WMI CIM Studio轻松浏览它。