How to Get Windows OS Version using PowerShell
In this tutorial, you will learn how to use Windows PowerShell commands to determine the OS version of your Windows system.
Method 1 - Using the WMI Object
PowerShell has a Get-WmiObject
cmdlet that allows you to fetch information about the Windows Management Instrumentation (WMI) classes. We can use this cmdlet to query the information and then pipe the resulting output to the select
command. This will enable us to fetch the OS version as shown in the command below:
Get-WMIObject win32_operatingsystem | Select Version