Microsoft has recently made the Windows Management Framework (WMF) 5.1 bits available for download for Windows 7, Windows 8.1, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2. This version of the framework brings a useful discovery cmdlet named Get-ComputerInfo.
Let's have a quick look at the information it can provide.
When you run it for the first time you can see that it tries to fetch information around the following objects, as you can read in the progress bar:
- Operating system
- Hot-patch
- Registry
- Bios
- Motherboard
- Computer
- Processor
- Network adapter
All the returned values are consolidated in a single easy-to-read PSCustomObject which boasts 181 properties. The nice thing of using this cmdlet is that you don't get all the noisy information that is commonly returned by Get-WMIObject, like the genus, class, superclass or namespace properties. You get directly the information in a nicely formatted way like the one returned by running Get-CIMInstance. But in a single cmdlet.
In other words, with a single cmdlet you can get the equivalent of running Get-CIMInstance against those instances: Win32_BIOS, Win32_ComputerSystem, Win32_OperatingSystem, Win32_TimeZone, plus a bunch of miscellaneous information such as the logon server, which you used to retrieve from HKCU\Volatile Environment\LOGONSERVER or from your $env:LOGONSERVER variable, or the calculated property Uptime, which is the difference between now (as you could get from Get-Date) and the LastBootUpTime value from Win32_OperatingSystem (check my post on Windows Boot Time if you want to know more on how this is calculated), or also the information related to the Device Guard feature:
DeviceGuardRequiredSecurityProperties DeviceGuardAvailableSecurityProperties DeviceGuardSecurityServicesConfigured DeviceGuardSecurityServicesRunning DeviceGuardCodeIntegrityPolicyEnforcementStatus DeviceGuardUserModeCodeIntegrityPolicyEnforcementStatus
It is worth noticing that Get-ComputerInfo returns also information about processor support for Second Level Address Translation as well as for other Hyper-V requirements (I wrote a blog post about this a while back) without getting your hands dirty with CoreInfo or SystemInfo:
HyperVisorPresent : True HyperVRequirementDataExecutionPreventionAvailable : HyperVRequirementSecondLevelAddressTranslation : HyperVRequirementVirtualizationFirmwareEnabled : HyperVRequirementVMMonitorModeExtensions :
It also returns the list of hotfixed installed without having to launch Get-HotFix: just use Select-Object with -ExpandProperty and you'll get the unique id of each fix, as well as the install date and the description:
Get-ComputerInfo | Select-Object -ExpandProperty OsHotFixes HotFixID Description InstalledOn FixComments -------- ----------- ----------- ----------- KB3192137 Update 9/12/2016 KB3199986 Update 11/17/2016 KB3206632 Security Update 1/3/2017
What else, you're asking?
The nice thing I would add is that you can easily limit the subset or returned information by passing to this cmdlet exact or wildcarded property names:
Get-ComputerInfo *mem* CsTotalPhysicalMemory : 17179398144 CsPhyicallyInstalledMemory : 16777216 OsTotalVisibleMemorySize : 16776756 OsFreePhysicalMemory : 11959208 OsTotalVirtualMemorySize : 19267124 OsFreeVirtualMemory : 14368488 OsInUseVirtualMemory : 4898636 OsMaxProcessMemorySize : 137438953344
Or you can generate calculated properties, like in the following example:
Get-ComputerInfo -Property "CsProcessors","CsNumberOfProcessors","CsNumberOfLogicalProcessors","CsPhyicallyInstalledMemory" | Format-List "CsProcessors","CsNumberOfProcessors","CsNumberOfLogicalProcessors",@{label="CsPhyicallyInstalledMemory (GB)";expression={$_.CsPhyicallyInstalledMemory/1MB}} CsProcessors : {Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz, Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz} CsNumberOfProcessors : 2 CsNumberOfLogicalProcessors : 2 CsPhyicallyInstalledMemory (GB) : 16
So, to sum up Get-ComputerInfo is a very useful cmdlet, but lacks native remoting capabilities, which is something that will come for sure in the future. There is a open request for this on UserVoice by fellow MVP Jan Egil Ring, which I invite you to vote for.
To finish with, know that this cmdlet has a 'gin' alias, for faster use:
Get-Command gin CommandType Name Version Source ----------- ---- ------- ------ Alias gin -> Get-ComputerInfo 3.1.0.0 Microsoft.PowerShell.Management
The journey to a robust administration language continues.
UPDATE February 9th 2017: Get-ComputerInfo will onyl work on Windows 10 if WinRM is enabled due to a bug in the source code. So if Get-ComputerInfo runs slowly and returns empty values, just run Enable-PSRemoting -force on your computer and you are good to go. This bug has been fixed but will have to wait for a future PowerShell release before being able to use the corrected version.
UPDATE February 9th 2017: Get-ComputerInfo will onyl work on Windows 10 if WinRM is enabled due to a bug in the source code. So if Get-ComputerInfo runs slowly and returns empty values, just run Enable-PSRemoting -force on your computer and you are good to go. This bug has been fixed but will have to wait for a future PowerShell release before being able to use the corrected version.