How To Get Windows Powershell Version
Go the Windows Version in PowerShell
- Using the
[System.Environs]Course in PowerShell to Get the Windows Version - Using the
Get-ComputerInfoCmdlet in PowerShell to Get the Windows Version - Using the WMI Class With
Become-WMIObjectCmdlet in PowerShell to Become the Windows Version - Using the
systeminfoLegacy Command
The fastest way to get which Windows operating system your computer has is to use the winver control. In Windows PowerShell, there are multiple ways to get your Windows version operating system, and nosotros volition discuss them hither in this article.
Using the [Organisation.Surroundings] Form in PowerShell to Get the Windows Version
If you have admission to the .NET library, y'all could admission the OSVersion property of the [System.Surround] grade.
Instance Code:
[Organization.Environment]::OSVersion.Version Output:
Major Minor Build Revision ----- ----- ----- -------- 10 0 22000 0 We may refer to the official Microsoft Document to cantankerous-reference the current Windows version operating system that yous are currently running.
However, this will not bear witness the right version if you're using the newest operating systems like Windows 11 or Windows Server 2019, as it will still bear witness a Major build x, which represents Windows 10 and Windows Server 2016. Therefore, the command to a higher place will only show proper values if you run Windows 10 and Windows Server 2016 beneath.
Using the Get-ComputerInfo Cmdlet in PowerShell to Go the Windows Version
Using the Get-ComputerInfo alone will output a lot of properties. We can only call the WindowsProductName, Windows Version, and OSHardwareAbstractionLayer properties from these set of properties to get the Windows operating system version.
Instance Code:
Go-ComputerInfo | select WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer Output:
WindowsProductName WindowsVersion OsHardwareAbstractionLayer ------------------ -------------- -------------------------- Windows 10 Pro 2009 10.0.22000.i Similar the previous [Arrangement.Environs] course, this cmdlet will brandish correct values if your operating arrangement uses Windows 10 and Windows Server 2016 versions and below.
At that place is a similar control which checks for the HKLM registry and will display the Windows Version property of the Get-ComputerInfo cmdlet.
Example Code:
(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ReleaseId Output:
2009 The Windows Version property presented above is what we call the operating arrangement build number. Build number 2009 represents a Windows ten build. It means that this command only applies to operating systems Windows 10 and Windows Server 2016 and beneath.
Using the WMI Form With Get-WMIObject Cmdlet in PowerShell to Get the Windows Version
Nosotros may also use the Windows Management Instrumentation (WMI) form to check for the current version of your operating organization.
Case Code:
(Get-WmiObject -form Win32_OperatingSystem).Caption Output:
Microsoft Windows 11 Habitation Unlike the [System.Environment] grade and Get-ComputerInfo cmdlet, the WMI object correctly displays the Windows operating system version if you're using the latest version.
Using the systeminfo Legacy Control
We can also utilise the systeminfo legacy control with Windows PowerShell cmdlet wrappers to output the detailed operating organization version.
systeminfo /fo csv | ConvertFrom-Csv | select Os*, System*, Hotfix* | Format-List Output:
Os Name : Microsoft Windows 11 Home OS Version : 10.0.22000 N/A Build 22000 Os Manufacturer : Microsoft Corporation OS Configuration : Standalone Workstation OS Build Type : Multiprocessor Complimentary System Boot Fourth dimension : 21/12/2021, 5:10:47 pm System Manufacturer : ASUSTeK COMPUTER INC. System Model : ASUS TUF Gaming A15 FA506IC_FA506IC System Blazon : x64-based PC System Directory : C:\Windows\system32 Organisation Locale : en-usa;English (United states of america) Hotfix(due south) : 3 Hotfix(s) Installed.,[01]: KB5007040,[02]: KB5007215,[03]: KB5006755 Write for us
DelftStack articles are written past software geeks like yous. If you besides would like to contribute to DelftStack by writing paid articles, you tin check the write for us page.
Source: https://www.delftstack.com/howto/powershell/find-windows-version-in-powershell/
Posted by: ohlwitints.blogspot.com

0 Response to "How To Get Windows Powershell Version"
Post a Comment