A2oz

How Do I Find Windows Version in PowerShell?

Published in Windows PowerShell 1 min read

You can easily find the Windows version using PowerShell. Here are two methods:

1. Using the $OS Variable:

The $OS variable stores various system information, including the Windows version. You can access this information using the following command:

$OS.Version

This command will output the Windows version, such as "10.0.19041."

2. Using the Get-ComputerInfo Cmdlet:

The Get-ComputerInfo cmdlet provides detailed system information, including the Windows version. You can access this information using the following command:

Get-ComputerInfo | Select-Object -Property OperatingSystem

This command will output the Windows version in a more readable format, such as "Windows 10 Enterprise".

Example:

Here's an example of how to use both methods to find the Windows version:

# Using the $OS variable
$OS.Version

# Using the Get-ComputerInfo cmdlet
Get-ComputerInfo | Select-Object -Property OperatingSystem

These commands will display the Windows version on your system.

Related Articles