---
title: "Learn the Many Ways in PowerShell to Get The Windows Version"
description: "Stay informed and learn the many ways in PowerShell to Get the Windows Version through examples in this ATA Learning tutorial!"
canonical: "https://adamtheautomator.com/powershell-to-get-the-windows-version/"
---

# Learn the Many Ways in PowerShell to Get The Windows Version

> Stay informed and learn the many ways in PowerShell to Get the Windows Version through examples in this ATA Learning tutorial!

Source: https://adamtheautomator.com/powershell-to-get-the-windows-version/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Learn the Many Ways in PowerShell to Get The Windows Version](https://adamtheautomator.com/wp-content/uploads/2022/12/powershell-get-windows-version.jpg)

# Learn the Many Ways in PowerShell to Get The Windows Version

[![](https://secure.gravatar.com/avatar/2788bb1a3f735603f81eca51d68daec56a9d97e805a10268fb2c20afcc76b81b?s=192&d=mm&r=g)Nicholas Xuan Nguyen](https://adamtheautomator.com/author/nicholas-xuan-nguyen/)23 December 20223 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[PowerShell](/tag/powershell/)[Windows](/tag/windows/)

Table of Contents

*   [Prerequisites](#prerequisites)
*   [Using PowerShell to Get the Windows Version](#using-powershell-to-get-the-windows-version)
*   [Selecting Specific Properties to Get the Windows Version](#selecting-specific-properties-to-get-the-windows-version)
*   [Retrieving the Windows Version via the System.Environment Class](#retrieving-the-windows-version-via-the-systemenvironment-class)
*   [Digging up Specific Property to Get the Windows Version](#digging-up-specific-property-to-get-the-windows-version)
*   [Querying for the Current Windows Version](#querying-for-the-current-windows-version)
*   [Conclusion](#conclusion)

Troubleshooting your system and need a quick way to get your Windows version? Fortunately, you can use PowerShell to get the Windows version you are on.

Checking what version of Windows you use is essential to manage your system. And in this tutorial, you will learn many ways to get your Windows version and more.

Read on and decide for yourself which method suits you best!

## Prerequisites

This tutorial will be a hands-on demonstration. To follow along, ensure you have a Windows system. This tutorial uses Windows 11 with [PowerShell 7](https://adamtheautomator.com/powershell-7-upgrade/).

Related:[PowerShell 7 Upgrade : A How to Walk Through](https://adamtheautomator.com/powershell-7-upgrade/)

## Using PowerShell to Get the Windows Version

Before taking on complex stuff with PowerShell, start with the basics, like getting your system information. With PowerShell, you can quickly get the Window version via the `systeminfo` command.

Open your PowerShell, and run the following command to get detailed information about your system, including the operating system (OS) version.

```bash
systeminfo.exe
```

Related:[Discover How to Run PowerShell as Administrator](https://adamtheautomator.com/powershell-run-as-administrator/)

Below, you can see detailed information about the OS, including the current version number, **10.0.22622 N/A Build 22622**.

![](https://adamtheautomator.com/wp-content/uploads/2023/06/image-2.png)

Getting the Windows version via the SystemInfo

## Selecting Specific Properties to Get the Windows Version

Great! You have just retrieved detailed system information. But if you look closely, the command is short, yet the output seems a lot.

If you only want specific property values, the [`Get-ComputerInfo`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-computerinfo?view=powershell-7.3) command is one of the quickest methods of getting specific system information, like your Windows version.

Run the below to get the Windows version, product name, and version of Windows Kernel and your system hardware’s Operating Hardware Abstraction (OHA).

Below, piping the `Select-Object` command to the `Get-ComputerInfo` command lets you retrieve only select properties.

```bash
Get-ComputerInfo | Select-Object OSName, OSVersion, OsHardwareAbstractionLayer
```

As you can see, Windows 10 Pro is installed, and its version is 2009.

![](https://adamtheautomator.com/wp-content/uploads/2023/06/image-1.png)

Getting the Windows version with the Get-ComputerInfo command

## Retrieving the Windows Version via the `System.Environment` Class

Another way to get the Windows version is through the `System.Environment` class. This class provides access to system information, such as the OS version, username, and other environment variables.

Related:[PowerShell Environment Variables: The Ultimate Guide](https://adamtheautomator.com/powershell-environment-variables/)

The `System.Environment` class also has a property called `OSVersion`, which contains information about the current OS.

Run the following command to call the `OSVersion.Version` property from the `System.Environment` class. The double colon (`::`) symbol is used to call static methods from a class.

```bash
[System.Environment]::OSVersion.Version
```

As you can see below, the output displays the OSVersion information as follows:

| Property | Value | Description |
| --- | --- | --- |
| Major | 10 | Despite saying 10, this may indicate Windows 10 or 11 as both use the same Major version. |
| Minor | 0 | There are two types of Windows releases, major and minor. Major releases are the “big” updates like the Creator update, and minor releases are smaller cumulative updates. |
| Build | 22622 | The number used to check the Windows version. In this case, it is for version 22H2. |
| Revision | 0 | Denotes a sub-version of the build. |

![](https://adamtheautomator.com/wp-content/uploads/2023/06/image-3.png)

Getting the windows via the `System.Environment` class

## Digging up Specific Property to Get the Windows Version

PowerShell cmdlets provide a handful of information about your system. But if you only plan to get your Windows version, the [`Get-ItemProperty`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-itemproperty?view=powershell-7.3) cmdlet is another option. This cmdlet command lets you access the registry and get various properties from it.

Run the below command to access the registry (`Get-ItemProperty`) and retrieve the `DisplayVersion` of your current Windows version (`HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion`). The Display Version (ReleaseID is deprecated) is a unique identifier for each Windows version.

```bash
(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").DisplayVersion
```

Below, the command retrieves and prints the current Windows version, which is 22H2.

![](https://ata-proxy-cors-headers.adamtheautomator.workers.dev/?https://adamtheautomator.com/wp-content/uploads/2023/06/image.png)

Getting the Windows version via the `Get-ItemProperty` command

## Querying for the Current Windows Version

You have seen how accessing properties lets you get your current Windows version. And while you are into properties, say hello to the [`Get-CimInstance`](https://learn.microsoft.com/en-us/powershell/module/cimcmdlets/get-ciminstance?view=powershell-7.3) cmdlet.

The `Get-CimInstance` cmdlet is another way to get your Windows version by querying Windows Management Instrumentation (WMI) objects. Doing so lets you access various properties from your system hardware.

Run the following command to query (`Get-CimInstance`) the `Win32_OperatingSystem` class (a WMI object) to get the current Windows `.version`. The `Win32_OperatingSystem` class provides information about the OS.

```bash
(Get-CimInstance Win32_OperatingSystem) | Select-Object Caption, Version
```

As you can see below, this output is similar to using the `System.Environment` class. But this time, you only get the actual OS version without the property headers. The revision was also omitted as it is unavailable from the WMI object.

![](https://adamtheautomator.com/wp-content/uploads/2023/06/image-4.png)

Querying WMI for the current Windows version

## Conclusion

Throughout this tutorial, you have learned a plethora of ways in PowerShell to get the current Windows version. Checking the Windows version in PowerShell is a valuable skill to have. This skill can be handy whether you are troubleshooting system issues or checking the compatibility of applications with your current OS.

Now, why not create a script for checking your Windows version? Perhaps schedule a task to run the script at certain times?

Related:[PowerShell Scheduled Task : Amazing Way to Manage Tasks](https://adamtheautomator.com/powershell-scheduled-task/)

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fpowershell-to-get-the-windows-version%2F&text=Learn%20the%20Many%20Ways%20in%20PowerShell%20to%20Get%20The%20Windows%20Version)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fpowershell-to-get-the-windows-version%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fpowershell-to-get-the-windows-version%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2023/03/powershell-ip-configuration.jpg)

### [PowerShell IP Configuration: A Beginner’s Guide to Windows Settings](/powershell-ip-configuration/)

Master PowerShell IP Configuration: Learn to set up and troubleshoot network IPs on Windows effortlessly. A comprehensive guide for efficient network management.

![](https://adamtheautomator.com/wp-content/uploads/2021/10/photo-1530133532239-eda6f53fcf0f.jpg)

### [How to Disable IPv6 on Windows](/disable-ipv6/)

If you don’t plan on using IPv6 any time soon, learn how to disable IPv6 in Windows in this step-by-step tutorial.

![](https://adamtheautomator.com/wp-content/uploads/2026/06/26995-troubleshoot-dns-issues-powershell-codex.webp)

### [Troubleshoot DNS Issues with PowerShell](/troubleshoot-dns-issues-powershell/)

Troubleshoot DNS issues with PowerShell by testing name resolution, DNS client settings, cache entries, and network connectivity in a repeatable workflow.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
