A lot of users don’t know how to make PowerShell get Windows version. Are you searching for the answer? This post on MiniTool is worth reading. It provides 5 simple ways to get Windows version PowerShell on Windows 10/11.
PowerShell is a practical Windows built-in command-line shell and scripting environment tool. It’s widely used by people to do various works such as PowerShell map network drive, PowerShell get current username, PowerShell change directory, PowerShell copy files, PowerShell gets folder size, PowerShell install SSH, etc.
However, a lot of users and even professionals don’t know how to do these works in PowerShell. So, you may find many answers that lack detailed steps and clear screenshots in different forums. Don’t worry. This post walks you through the full steps to get OS version PowerShell.
What Command Can Be Used to Check Windows Version PowerShell
What command can make PowerShell get OS version? After investigating extensive user comments and performing verifications, we find many cmdlets can find detailed information about Windows version PowerShell. Here we summarize them as follows:
- Systeminfo: It will display detailed information about a computer and its OS, including system version, Windows build, security information, etc.
- System.Environment: It can be used to check the current environment and Windows version of a computer.
- Get-ComputerInfo: It can specify the Windows version and operating system properties in PowerShell.
- Get-ItemProperty: It can get the properties of the Windows version in PowerShell.
- Get-CimInstance: It can get the specified information about the Windows build version in PowerShell.
How to Make PowerShell Get Windows Version on Windows 10/11
This part will show you how to let PowerShell get OS version using the following 5 methods. You can try them in order or choose one that works best for you.
Some operations require your computer to have PowerShell v5.1 or a higher version installed. If you are not using the latest version, read this post “How to Update PowerShell Version to v7.2.5 for Windows 10/11”.
# 1. PowerShell Get Windows Version via Systeminfo
If you want to get Windows version PowerShell directly, you can use the Systeminfo command. Here’s how to use it.
Step 1. Press the Win + R keys to open the Run box, and then type powershell in it and press Ctrl + Shift + Enter keys to open the elevated PowerShell window.
Step 2. In the pop-up window, type the systeminfo command and hit Enter. Then you will get detailed information about your computer, including Windows OS version, OS name, system type, etc.
# 2. PowerShell Get Windows Version via System.Environment
The System.Environment class can also help you get PowerShell Windows version on Windows 10/11. To do this work, you just need to open the elevated PowerShell window as we explained above, type the following command and hit Enter to access the value of the Windows version.
[System.Environment]::OSVersion.Version
# 3. PowerShell Get Windows Version via Get-ComputerInfo
Another simple method to make PowerShell get operating system version is to use the Get-ComputerInfo command. It will display the Windows version, Windows Product name, and OS hardware information. You can type the following command in PowerShell and hit Enter to run it.
Get-ComputerInfo | select WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer
# 4. PowerShell Get Windows Version via Get-ItemProperty
The Get-ItemProperty cmdlet can help you check Windows version PowerShell using the Registry key. To run it, open the elevated PowerShell window, type the following command, and hit Enter. The output in the following picture indicates that the current Windows version is “2009”.
(Get-ItemProperty “HKLM:SOFTWAREMicrosoftWindows NTCurrentVersion”).ReleaseId
# 5. PowerShell Get Windows Version via Get-CimInstance
To get OS version PowerShell via the Get-CimInstance command, you can open the PowerShell window, type the following command and hit Enter to get the specified Windows OS version. For example, the current Windows version of my computer is Windows 10 build 19045.
(Get-CimInstance Win32_OperatingSystem).version
Further reading: If you enter some issues like file system corruption and low disk space on Windows, don’t worry. MiniTool Partition Wizard can help you fix them easily by checking file system errors, extending/resizing partitions, analyzing disk space, upgrading to a larger hard disk, etc.
MiniTool Partition Wizard FreeClick to Download100%Clean & Safe