Site icon Think PowerShell

Use Get-ComputerInfo to Replace msinfo32

Get-ComputerInfo in progress...
Get-ComputerInfo in progress…

The fifth post in my PowerShell Beginner series, “Daily Tasks, The PowerShell Way“. Use PowerShell’s Get-ComputerInfo to get the same information as you would from the msinfo32 System Summary. Replace multiple WMI queries with one cmdlet.

Tell me about yourself

Whether it is a recurring system inventory task or an ad hoc inquiry to gain situational awareness, there are many times you want to get a standard set of information for a computer. Previously, you might right-click “My Computer” and select Properties, or right-click the Start Menu and select System to get some information. You may run msinfo32 from the command line to get a summary information set. If you were already scripting, you may be using VBScript or PowerShell, you may have already had a set of scripts for querying against environmental variables or WMI to pull a standard information set, or are leveraging System Center Configuration Manager.

The challenge with all of these various methods is they were either manual data collection via graphical UI, or required numerous environmental variable or WMI queries to compile a useful information set.

Get-ComputerInfo: a consolidated system properties object

In PowerShell 5.1, the Get-ComputerInfo cmdlet was introduced. Per the TechNet page, it “Gets a consolidated object of system and operating system properties“. In its first iteration, 181 properties are returned! Compare that to the 38 properties displayed on the msinfo32 System Summary pane, and you can immediately get a feel for the potential of this cmdlet.

A full example output from my laptop is down below, but here are some filtered information sets you may find useful. The only unique parameter for this cmdlet is Property, where you can specify multiple properties using comma delimiters.

Can this computer run Hyper-V?

Did you read Use PowerShell to Set Up a Hyper-V Lab and want to know if your computer can run Hyper-V? Here is the Get-ComputerInfo query that will tell you. Note the use of the * wildcard to return all of the HyperVRequirement properties.

PS C:\Users\aaron> Get-ComputerInfo -Property "WindowsEditionId","HyperVRequirement*"


WindowsEditionId                                  : Professional
HyperVRequirementDataExecutionPreventionAvailable : True
HyperVRequirementSecondLevelAddressTranslation    : True
HyperVRequirementVirtualizationFirmwareEnabled    : True
HyperVRequirementVMMonitorModeExtensions          : True

What is the computer make, model and serial, and BIOS version?

Mileage will vary depending on your system build, but if it is a known manufacturer this should do the trick (note that in this release there is a spelling error for “Serial”). For all BIOS information, try running Get-ComputerInfo -Property “Bios*”.

PS C:\Users\aaron> Get-ComputerInfo -Property "CSManufacturer","CSModel","BiosSeralNumber","BiosSMBIOSBIOSVersion" | Format-List


CsManufacturer        : Dell Inc.
CsModel               : Inspiron 7520
BiosSeralNumber       : JNXTHV4
BiosSMBIOSBIOSVersion : A11

What does the computer have for processor and memory?

Here we reformat the results from Get-ComputerInfo for memory, which is returned in KB, to a more readable GB value.

PS C:\Users\aaron> Get-ComputerInfo -Property "CsProcessors","CsNumberOfProcessors","CsNumberOfLogicalProcessors","CsPhyicallyInstalledMemory" | Format-List "CsProcessors","CsNumberOfProcessors","CsNumberOfLogicalProcessors",@{label="CsPhyicallyInstalledMemory (GB)";expression={$_.CsPhyicallyInstalledMemory/1MB}}


CsProcessors                    : {Intel(R) Core(TM) i7-3612QM CPU @ 2.10GHz}
CsNumberOfProcessors            : 1
CsNumberOfLogicalProcessors     : 8
CsPhyicallyInstalledMemory (GB) : 8

What are the Windows OS details for this computer?

There are a lot of Windows related properties scattered through the list (it is a Windows OS, after all), but here are a few useful ones for a quick view:

PS C:\Users\aaron> Get-ComputerInfo -Property "CsName","OsName","OsVersion","OsArchitecture","OsLanguage","OsProductType","WindowsInstallDateFromRegistry","WindowsSystemRoot" | Format-List



CsName                         : TPS1-AARON
OsName                         : Microsoft Windows 10 Pro
OsVersion                      : 10.0.14393
OsArchitecture                 : 64-bit
OsLanguage                     : en-US
OsProductType                  : WorkStation
WindowsInstallDateFromRegistry : 8/5/2016 3:38:38 AM
WindowsSystemRoot              : C:\WINDOWS

Other useful combinations?

These combinations were just a few that provide some quick value. If you have suggestions for others, please put them in the Comments to share!

Here is the full output from my laptop:

PS C:\Users\aaron> Get-ComputerInfo


WindowsBuildLabEx                                       : 14393.321.amd64fre.rs1_release_inmarket.161004-2338
WindowsCurrentVersion                                   : 6.3
WindowsEditionId                                        : Professional
WindowsInstallationType                                 : Client
WindowsInstallDateFromRegistry                          : 8/5/2016 3:38:38 AM
WindowsProductId                                        : 00330-80000-00000-AA112
WindowsProductName                                      : Windows 10 Pro
WindowsRegisteredOrganization                           : 
WindowsRegisteredOwner                                  : aaron@thinkpowershell.com
WindowsSystemRoot                                       : C:\WINDOWS
BiosCharacteristics                                     : {7, 9, 11, 12...}
BiosBIOSVersion                                         : {DELL   - 1, InsydeH2O Version 03.72.24A11, InsydeH2O Version 03.72.24A11}
BiosBuildNumber                                         : 
BiosCaption                                             : InsydeH2O Version 03.72.24A11
BiosCodeSet                                             : 
BiosCurrentLanguage                                     : en|US|iso8859-1
BiosDescription                                         : InsydeH2O Version 03.72.24A11
BiosEmbeddedControllerMajorVersion                      : 1
BiosEmbeddedControllerMinorVersion                      : 1
BiosFirmwareType                                        : Bios
BiosIdentificationCode                                  : 
BiosInstallableLanguages                                : 2
BiosInstallDate                                         : 
BiosLanguageEdition                                     : 
BiosListOfLanguages                                     : {en|US|iso8859-1, zh|TW|unicode}
BiosManufacturer                                        : Dell Inc.
BiosName                                                : InsydeH2O Version 03.72.24A11
BiosOtherTargetOS                                       : 
BiosPrimaryBIOS                                         : True
BiosReleaseDate                                         : 2/19/2014 6:00:00 PM
BiosSeralNumber                                         : JNKTHV4
BiosSMBIOSBIOSVersion                                   : A11
BiosSMBIOSMajorVersion                                  : 2
BiosSMBIOSMinorVersion                                  : 7
BiosSMBIOSPresent                                       : True
BiosSoftwareElementState                                : Running
BiosStatus                                              : OK
BiosSystemBiosMajorVersion                              : 255
BiosSystemBiosMinorVersion                              : 255
BiosTargetOperatingSystem                               : 0
BiosVersion                                             : DELL   - 1
CsAdminPasswordStatus                                   : Unknown
CsAutomaticManagedPagefile                              : True
CsAutomaticResetBootOption                              : True
CsAutomaticResetCapability                              : True
CsBootOptionOnLimit                                     : 
CsBootOptionOnWatchDog                                  : 
CsBootROMSupported                                      : True
CsBootStatus                                            : {0, 0, 0, 0...}
CsBootupState                                           : Normal boot
CsCaption                                               : TPS1-AARON
CsChassisBootupState                                    : Safe
CsChassisSKUNumber                                      : 
CsCurrentTimeZone                                       : -300
CsDaylightInEffect                                      : True
CsDescription                                           : AT/AT COMPATIBLE
CsDNSHostName                                           : tps1-aaron
CsDomain                                                : WORKGROUP
CsDomainRole                                            : StandaloneWorkstation
CsEnableDaylightSavingsTime                             : True
CsFrontPanelResetStatus                                 : Unknown
CsHypervisorPresent                                     : False
CsInfraredSupported                                     : False
CsInitialLoadInfo                                       : 
CsInstallDate                                           : 
CsKeyboardPasswordStatus                                : Unknown
CsLastLoadInfo                                          : 
CsManufacturer                                          : Dell Inc.
CsModel                                                 : Inspiron 7520
CsName                                                  : TPS1-AARON
CsNetworkAdapters                                       : {Ethernet 3, Wi-Fi, Ethernet, Bluetooth Network Connection...}
CsNetworkServerModeEnabled                              : True
CsNumberOfLogicalProcessors                             : 8
CsNumberOfProcessors                                    : 1
CsProcessors                                            : {Intel(R) Core(TM) i7-3612QM CPU @ 2.10GHz}
CsOEMStringArray                                        : {Dell System, 1[0572], 14[2], 15[0]...}
CsPartOfDomain                                          : False
CsPauseAfterReset                                       : -1
CsPCSystemType                                          : Mobile
CsPCSystemTypeEx                                        : Mobile
CsPowerManagementCapabilities                           : 
CsPowerManagementSupported                              : 
CsPowerOnPasswordStatus                                 : Unknown
CsPowerState                                            : Unknown
CsPowerSupplyState                                      : Safe
CsPrimaryOwnerContact                                   : 
CsPrimaryOwnerName                                      : aaron@thinkpowershell.com
CsResetCapability                                       : Other
CsResetCount                                            : -1
CsResetLimit                                            : -1
CsRoles                                                 : {LM_Workstation, LM_Server, NT}
CsStatus                                                : OK
CsSupportContactDescription                             : 
CsSystemFamily                                          : 103C_5335KV
CsSystemSKUNumber                                       : Inspiron 7520
CsSystemType                                            : x64-based PC
CsThermalState                                          : Safe
CsTotalPhysicalMemory                                   : 8459231232
CsPhyicallyInstalledMemory                              : 8388608
CsUserName                                              : TPS1-AARON\aaron
CsWakeUpType                                            : PowerSwitch
CsWorkgroup                                             : WORKGROUP
OsName                                                  : Microsoft Windows 10 Pro
OsType                                                  : WINNT
OsOperatingSystemSKU                                    : 48
OsVersion                                               : 10.0.14393
OsCSDVersion                                            : 
OsBuildNumber                                           : 14393
OsHotFixes                                              : {KB3176936, KB3194343, KB3199209, KB3194798}
OsBootDevice                                            : \Device\HarddiskVolume1
OsSystemDevice                                          : \Device\HarddiskVolume2
OsSystemDirectory                                       : C:\WINDOWS\system32
OsSystemDrive                                           : C:
OsWindowsDirectory                                      : C:\WINDOWS
OsCountryCode                                           : 1
OsCurrentTimeZone                                       : -300
OsLocaleID                                              : 0409
OsLocale                                                : en-US
OsLocalDateTime                                         : 10/25/2016 8:37:46 PM
OsLastBootUpTime                                        : 10/12/2016 8:18:20 PM
OsUptime                                                : 13.00:19:25.6935135
OsBuildType                                             : Multiprocessor Free
OsCodeSet                                               : 1252
OsDataExecutionPreventionAvailable                      : True
OsDataExecutionPrevention32BitApplications              : True
OsDataExecutionPreventionDrivers                        : True
OsDataExecutionPreventionSupportPolicy                  : OptIn
OsDebug                                                 : False
OsDistributed                                           : False
OsEncryptionLevel                                       : 256
OsForegroundApplicationBoost                            : Maximum
OsTotalVisibleMemorySize                                : 8260968
OsFreePhysicalMemory                                    : 1673288
OsTotalVirtualMemorySize                                : 12601852
OsFreeVirtualMemory                                     : 1791384
OsInUseVirtualMemory                                    : 10810468
OsTotalSwapSpaceSize                                    : 
OsSizeStoredInPagingFiles                               : 4340884
OsFreeSpaceInPagingFiles                                : 3886356
OsPagingFiles                                           : {C:\pagefile.sys}
OsHardwareAbstractionLayer                              : 10.0.14393.206
OsInstallDate                                           : 8/4/2016 10:38:38 PM
OsManufacturer                                          : Microsoft Corporation
OsMaxNumberOfProcesses                                  : 4294967295
OsMaxProcessMemorySize                                  : 137438953344
OsMuiLanguages                                          : {en-US}
OsNumberOfLicensedUsers                                 : 
OsNumberOfProcesses                                     : 144
OsNumberOfUsers                                         : 2
OsOrganization                                          : 
OsArchitecture                                          : 64-bit
OsLanguage                                              : en-US
OsProductSuites                                         : {TerminalServicesSingleSession}
OsOtherTypeDescription                                  : 
OsPAEEnabled                                            : 
OsPortableOperatingSystem                               : False
OsPrimary                                               : True
OsProductType                                           : WorkStation
OsRegisteredUser                                        : aaron@thinkpowershell.com
OsSerialNumber                                          : 00330-80000-00000-AA112
OsServicePackMajorVersion                               : 0
OsServicePackMinorVersion                               : 0
OsStatus                                                : OK
OsSuites                                                : {TerminalServices, TerminalServicesSingleSession}
OsServerLevel                                           : 
KeyboardLayout                                          : en-US
TimeZone                                                : (UTC-06:00) Central Time (US & Canada)
LogonServer                                             : \\TPS1-AARON
PowerPlatformRole                                       : Mobile
HyperVisorPresent                                       : False
HyperVRequirementDataExecutionPreventionAvailable       : True
HyperVRequirementSecondLevelAddressTranslation          : True
HyperVRequirementVirtualizationFirmwareEnabled          : True
HyperVRequirementVMMonitorModeExtensions                : True
DeviceGuardSmartStatus                                  : Off
DeviceGuardRequiredSecurityProperties                   : 
DeviceGuardAvailableSecurityProperties                  : 
DeviceGuardSecurityServicesConfigured                   : 
DeviceGuardSecurityServicesRunning                      : 
DeviceGuardCodeIntegrityPolicyEnforcementStatus         : 
DeviceGuardUserModeCodeIntegrityPolicyEnforcementStatus :

 

Exit mobile version