tags:

views:

71

answers:

1

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

PS D:\work\scripts> measure-command { get-wmiobject -query "select * from cim_service" | Where-Object -FilterScript {$_. Name -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

A: 

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.

You can easily explore it via WMI CIM Studio.

Andrey