You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Get-ComputerInfo - takes as long to get 1 property as 183 properties #9234
Issue-Enhancementthe issue is more of a feature request than a bugIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Engine-Performancecore PowerShell engine, interpreter, and runtime performance
Get-ComputerInfo returns 183 properties in 7 seconds.
Get-ComputerInfo -Property TimeZone returns 1 property in .. 7 seconds.
Get-TimeZone runs in 0.0015 seconds. and returns more detailed information.
Can it run faster, if asked for less data?
Environment:
Name Value
---------
PSVersion 6.1.0
PSEdition Core
GitCommitId 6.1.0
OS Microsoft Windows 10.0.14393
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Reacted by Michael Klement, Rain Sallow (/u/ta11ow), PRASOON KARUNAN V and bwarren18
Looking at the data returned I think its already using WMI. I suspect the speed issue is because its gathering all the data and then filtering down to the properties you asked for
RichardSiddaway It is using WMI (well, CIM if I recall correctly). At the time the cmdlet was originally written, the mandate was to collect and display all the data. The ability to report a single property was added kind of at the last minute and the decision at the time was to continue collecting all, then select to one to report.
WMI was Microsoft's first CIM implementation. CIM (in PowerShell terms) was the methodology introduced in PowerShell v3 including CIM sessions
These days CIM and WMI are interchangeable unless you're talking about the WMI or CIM cmdlets
I'm not sure why the designers of the cmdlet added property filtering capabilities. That is already available in Select-Object, so it seems like something that shouldn't have been there in there first place. If you read the source, it just gets everything, and if you only want a subset of the properties, it creates a psobject and populates it with those.
One good reason to add command/provider-specific filtering is performance (e.g., the -Filter parameter in provider cmdlets, and, as more direct analog, the -Property parameter of Get-AdUser), and that certainly applies here: You shouldn't have to wait seconds to retrieve a single piece of information.
This is unlikely ever to be fixed. Newer versions of PowerShell are open source and cross-platform, and the CIM code (along with a few Windows API function calls) are not portable to Linux or macOS.
As I've said before, the original mandate was to collect all the data. Only later was it decided to add -Property, which selects from all the already-collected data.
Issue-Enhancementthe issue is more of a feature request than a bugIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Engine-Performancecore PowerShell engine, interpreter, and runtime performance
Activity
tlsalex commentedon Mar 27, 2019
Agree with you , I also want to know the answer , maybe we need to use WMI
RichardSiddaway commentedon Mar 27, 2019
Looking at the data returned I think its already using WMI. I suspect the speed issue is because its gathering all the data and then filtering down to the properties you asked for
jeffbi commentedon Mar 27, 2019
RichardSiddaway It is using WMI (well, CIM if I recall correctly). At the time the cmdlet was originally written, the mandate was to collect and display all the data. The ability to report a single property was added kind of at the last minute and the decision at the time was to continue collecting all, then select to one to report.
RichardSiddaway commentedon Mar 28, 2019
WMI was Microsoft's first CIM implementation. CIM (in PowerShell terms) was the methodology introduced in PowerShell v3 including CIM sessions
These days CIM and WMI are interchangeable unless you're talking about the WMI or CIM cmdlets
powercode commentedon Apr 1, 2019
I'm not sure why the designers of the cmdlet added property filtering capabilities. That is already available in Select-Object, so it seems like something that shouldn't have been there in there first place. If you read the source, it just gets everything, and if you only want a subset of the properties, it creates a psobject and populates it with those.
Feature creep in my book.
mklement0 commentedon Feb 8, 2023
One good reason to add command/provider-specific filtering is performance (e.g., the
-Filterparameter in provider cmdlets, and, as more direct analog, the-Propertyparameter ofGet-AdUser), and that certainly applies here: You shouldn't have to wait seconds to retrieve a single piece of information.slycordinator commentedon Feb 1, 2024
Still valid:
PowerShell 7.4.1
Windows PowerShell (5.1.19041.3930)
In both cases,
Get-TimeZonescompletes about 1000 times faster thanGet-ComputerInfo -Property TimeZonejeffbi commentedon Feb 1, 2024
This is unlikely ever to be fixed. Newer versions of PowerShell are open source and cross-platform, and the CIM code (along with a few Windows API function calls) are not portable to Linux or macOS.
As I've said before, the original mandate was to collect all the data. Only later was it decided to add
-Property, which selects from all the already-collected data.