In PowerShell 5, a new cmdlet called Get-ComputerInfo was introduced which does what systeminfo.exe did in the past, yet Get-ComputerInfo is object-oriented right away. There are no localization issues:
$infos = Get-ComputerInfo
You can now query individual details about your computer:
Or use Select-Object to select all properties that interest you:
$infos | Select-Object -Property OSInstallDate, OSFreePhysicalMemory, BiosBIOSVersion
On the cons side, consider this: Get-ComputerInfo was introduced with PowerShell 5, and you can easily update to that version or use PowerShell Core side-by-side with an older version of Windows PowerShell. However, a lot of the information retrieved by Get-ComputerInfo stems from WMI classes that have been added only with recent Windows operating systems.
If you update to Windows PowerShell 5.1 on a Windows 7 box, chances are Get-ComputerInfo will not work right. On older systems, systeminfo.exe is your best bet, while on recent operating systems, Get-ComputerInfo is much easier to use.
You are a PowerShell Professional, passionate about improving your code and skills? You take security seriously and are always looking for the latest advice and guidance to make your code more secure and faster? You’d love to connect to the vibrant PowerShell community and get in touch with other PowerShell Professionals to share tricks and experience? Then PowerShell Conference EU 2020 might be just the right place for you: https://psconf.eu (June 2-5, 2020 in Hanover, Germany).
It’s a unique mixture of classic conference with three parallel tracks filled with fast-paced PowerShell presentations, and advanced learning class with live discussions, Q&A and plenty of networking.
Secure your seat while they last: https://psconf.eu/register.html. Help build the agenda and make this “your” event by submitting hypothetical sessions you’d like to hear: https://powershell.one/psconfeu/psconf.eu-2020/reverse-cfp. And if you’d like to present yourself and join the psconf.eu speakers’ team, submit proposals: https://sessionize.com/psconfeu/.
ReTweet this Tip!