Get operating system information on a remote computer with PowerShell

Hello,

Today we-ll retrieve a lot of useful informations about an operating system on a remote computer, such as the uptime, the last boot time, the languages, the install date, the OS version, the build, the service pack, and the OS architecture.
To get all of those informations, we’ll use the “Win32_OperatingSystem” WMI class.

Get-WmiObject Win32_OperatingSystem -ComputerName SQL

If you look at the MSDN link just above, or use “Get-Member“, you’ll see all the properties available in that class. Here some of them :

Gwmi-OS

As you can see, the dates aren’t very readable, you need to convert them with [System.Management.ManagementDateTimeConverter] .Net class and the “ToDateTime” method :

Get-WmiObject Win32_OperatingSystem -ComputerName SQL,2K8R2,WSUS,SOFSR2Node1,SOFSR2Node2 | Select-Object CSName,Caption,CSDVersion,@{Label="InstallDate";Expression={[System.Management.ManagementDateTimeConverter]::ToDateTime($($_.InstallDate))}},@{Label="LastBootUpTime";Expression={[System.Management.ManagementDateTimeConverter]::ToDateTime($($_.LastBootUpTime))}},MUILanguages,OSArchitecture,ServicePackMajorVersion,Version | Format-Table

Gwmi-OS-Selected

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.