25

During the beta of Windows 10 it was hard know what version you were running unless it had it posted to the desktop. Once that wasn't there - how do you tell what version / build you are running?

This will become more of an issue as Microsoft starts releasing more builds with the new update mechanism.

1
  • I don't believe that updates alter the build number.
    – joeqwerty
    Aug 17, 2015 at 18:36

12 Answers 12

23

WMI does not currently have properties that can be used to completely identify the Windows 10 version (like 1607) or full build number (like 10.0.14393.577). As stated in other comments, this information is visible in the registry under this key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion

The following values in that key correspond to the information displayed by the winver.exe program:

ReleaseID = Version (name based on year/month of release: 1507, 1511, 1607, 1703, etc.)
CurrentBuild or CurrentBuildNumber = OS Build (part before period)
UBR = OS Build (part after period)

Additionally, the version numbers are in these two values from that registry key:

CurrentMajorVersionNumber = 10
CurrentMinorVersionNumber = 0

The build changes when the Version (like 1607) changes or when Insider builds are installed. However, the UBR (Update Build Revision) does change with certain updates as indicated in Microsoft's release list.

In PowerShell,

[System.Environment]::OSVersion.Version

returns Major, Minor, and Build the same as the registry key, but it always seems to report Revision as 0. A bit of code from a Reddit user provides an adequate replacement that includes the UBR from the registry as the Revision number:

$WinVer = New-Object -TypeName PSObject
$WinVer | Add-Member -MemberType NoteProperty -Name Major -Value $(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion' CurrentMajorVersionNumber).CurrentMajorVersionNumber
$WinVer | Add-Member -MemberType NoteProperty -Name Minor -Value $(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion' CurrentMinorVersionNumber).CurrentMinorVersionNumber
$WinVer | Add-Member -MemberType NoteProperty -Name Build -Value $(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion' CurrentBuild).CurrentBuild
$WinVer | Add-Member -MemberType NoteProperty -Name Revision -Value $(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion' UBR).UBR
$WinVer
4
  • @Ramhound i.e. his whole answer?!
    – oldmud0
    Dec 27, 2016 at 5:53
  • @oldmud0 of course not; there is something there that's acceptable
    – Ramhound
    Dec 27, 2016 at 6:06
  • @RamHound Thanks for the feedback. I cut some cruft. If it's still too verbose, let me know. Dec 27, 2016 at 18:09
  • This is the correct answer. It includes ReleaseID (e.g. 1607), build (e.g. 14393), and UBR (the number that changes with each monthly release). Note that ReleaseID and build are redundant in that there is a 1-1 mapping between the two; I'd love to read something from Microsoft about why both of these numbers exist. Oct 5, 2017 at 14:42
20

GUI: Settings, System, About

Not sure if this is the 'proper' way, but you can get the Win10 vocalized/talked-about 'version' (1511, 1607, etc.) via this cmd:

Reg Query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ReleaseId

Here is Microsoft's page to correlate build numbers to Win10 'version' (backup link [wiki] just in case). Helped me when I get build # from remote PC: wmic /node:HOSTNAME os get BuildNumber

8
  • 7
    Thank you - that helped me a lot. Just for the case - PowerShell version of your command would be (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId).ReleaseId Apr 27, 2017 at 19:02
  • This doesn't work on Windows 10 Enterprise LTSB. Only the solutions that read version from powershell directly work for me
    – phuclv
    Mar 19, 2018 at 4:46
  • I'm running LTSB myself & it works for me?
    – gregg
    Mar 19, 2018 at 16:18
  • it's not working in my latest Windows 10 Pro either: on 10.0.17730.1000 (i.e. build 17730) it gives ReleaseId REG_SZ 1803. This and this works
    – phuclv
    Aug 9, 2018 at 7:33
  • 1
    @phuclv, Topic started asked about build / version. To get BuildNumber you can use a zillion of ways as shown here. Most people care about version as it essentially denotes different Windows functionality. To get a version ( 1507, 1511, 1607, 1703, etc) either use winver or query ReleaseID from the registry. Overall we are arguing about nothing. It is MS who mixed things up. Aug 9, 2018 at 8:16
9

Checking the version or the build number of Windows 10 is not very helpful because it doesn't change over time.

It turns out that first sentence is wrong; it was true in all previous versions of Windows, but we are in a new Windows 10 world now. The latest insiders build has a build number of 10525 compared to "RTM": 10240.

There are several ways to get the build number on the command line:

systeminfo.exe
(Get-CimInstance -ClassName Win32_OperatingSystem -Namespace root/cimv2).BuildNumber
(Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name CurrentBuild).CurrentBuild

The last of the three is the fastest.

If you prefer the GUI, you can use winver.exe or the About entry in the Help menu of most Windows desktop applications.

With no service packs around any more, the patch-level on the OS depends on the installed updates. There are several ways to find these, GUI, systeminfo.exe, wmi, etc.

The recommended and most powerful way to do things like this is using PowerShell:

Get-HotFix

shows something like:

Source        Description      HotFixID      InstalledBy          InstalledOn
------        -----------      --------      -----------          -----------
WIN10         Security Update  KB3074663     NT AUTHORITY\SYSTEM  7/17/2015 12:00:00 AM
WIN10         Security Update  KB3074667     NT AUTHORITY\SYSTEM  7/21/2015 12:00:00 AM
WIN10         Security Update  KB3074674     NT AUTHORITY\SYSTEM  7/24/2015 12:00:00 AM
WIN10         Update           KB3074678     NT AUTHORITY\SYSTEM  7/31/2015 12:00:00 AM

You can filter for updates in the last 10 days:

Get-Hotfix | Where {$_.InstalledOn -gt $(Get-Date).AddDays(-10) -and $_.Description -eq "Update"}

Or show the last three installed updates:

Get-Hotfix | Sort-object InstalledOn -Descending | Select -First 3

You can check whether a specific update is installed:

if ((get-hotfix -id kb3087916) -ne $null) {"patched..."}

You can first find the latest patch kb number online like:

(New-Object Net.WebClient).DownloadString('https://microsoft.com/...')

And then check whether it exists on the machine.

Note: this is just an example. I don't know of a page that currently lists these, and you still have to parse it.

The question is: Over time, will Microsoft change the functionality of Windows 10 so much that you have to check for it to make your app or script work.

It may be a better idea to check whether a specific feature you need exists on the system, rather than to look for a version number.

1
  • "it was true in all previous versions of Windows" In fact, it has not been true since Windows 95, at least. Windows 95 and Windows 95 OSR2 had different build numbers. As did Windows 98 and Windows 98se. As did Windows XP, Windows XP SP1, Windows XP SP2, and so on. Jul 12, 2017 at 21:03
5

I have been asked this a few times so I thought I would post it. There are three ways.

  1. Run winver.exe
  2. Run ver.exe
  3. Check the registry

For more details look here: http://mythoughtsonit.com/2015/07/what-build-version-of-windows-10-am-i-running/

5
  • 2
    Unfortunately Microsoft doesn't provide a mechanism to determine the cumulative update version. Since they don't really provide operating system service packs any longer, it would be useful information. An alternative would be to use the WMIC command to query for a specific rollup version. E.g. WMIC QFE GET HotfixID, InstalledOn, Description | FINDSTR /I "KB3081438" to determine if the August 15, 2015 CU is installed. A blank InstalledOn date indicates that they system has not restarted to complete the installation.
    – Greg Askew
    Aug 17, 2015 at 18:35
  • 1
    th Buildnumber 10240 doesn't change with updates. The last number 16xxx changes when the kernel gets an update. Aug 18, 2015 at 3:58
  • 2
    In my book this is the only true correct answer. Despite the claims of it not displaying the "cumulative update version" it actually does, now granted you need to know what the current build actually is, in order to compare it to but none of the other answers deal with that problem either.
    – Ramhound
    Mar 15, 2016 at 23:05
  • Running winver on the commandline works like a charm. Thanks!
    – Andreas
    Nov 10, 2017 at 5:37
  • this won't work for Windows 10 LTSB
    – phuclv
    Mar 19, 2018 at 4:47
2

PowerShell is always the answer:

Get-CimInstance win32_operatingsystem

More information:

Get-CimInstance Win32_OperatingSystem | Select-Object buildnumber,version

Returns:

buildnumber version
----------- -------
10240 10.0.10240

You can use this to really quickly get that information, plus, you can build it out into a function and use to to grab that information from your entire fleet if you need.

1
  • 2
    This answer could use a bit more explanation.
    – kasperd
    Aug 17, 2015 at 21:39
2

None of the previously posted ways work, and none of them give the OS Build as it appears in SettingsAbout section. It is missing the cumulative update information.

You could do something like this

$OSmBuild = (Get-WmiObject Win32_OperatingSystem).Version

if($OSmBuild -eq '10.0.10586')
{
    # Windows 10.0.10586.0
    $164 = Get-HotFix | where { $_.HotFixID -eq 'KB3140768' }
    $122 = Get-HotFix | where { $_.HotFixID -eq 'KB3140743' }
    $104 = Get-Hotfix | where { $_.HotfixID -eq 'KB3135173' }

    if($104 -and (!($122)) -and (!($164)))
    {
        Write-Host '104 installed'
    }
    elseif($104 -and $122 -and (!($164)))
    {
        Write-Host '122 installed'
    }
    elseif($104 -and $122 -and $164)
    {
        Write-Host '164 installed'
    }
}

in a PowerShell script, but it takes something that has always been a one-liner, and makes it more difficult to monitor. You can see the updates here:

Windows 10 update history

Hopefully Microsoft will update their patches so they start modifying the BuildNumber.

4
  • "Hopefully Microsoft will update their patches so they start modifying the BuildNumber " that happened since July 29th 2015......
    – Ramhound
    Mar 15, 2016 at 23:06
  • @Ramhound it has happened since july 29th 2015 or hasn't? Whenever i call Win32_OperatingSystem.Version i dont get the OS Build number i get 10.0.10586.0 when OS Build in Settings > System > About is 10.0.10586.164
    – d4rkcell
    Mar 16, 2016 at 9:43
  • The build didn't change until Threshold 2. Since Threshold 2, the build number has changed, with the cumulative patches. I never said Win32_OperatingSystem.Version should work the way you describe but the build is changing per winver ( in other words I am saying your script is at fault ).
    – Ramhound
    Mar 16, 2016 at 11:13
  • No it hasn't, it has in the UI but in WMI especially when querying Win32_OperatingSystem the Version number here still says 10.0.10586 and BuildNumber still says 10586. I am on a machine which has OSBuild 10586.164 in the Settings > System About OS Build section but in WMI it does not. Why dont you read what i typed?
    – d4rkcell
    Mar 17, 2016 at 15:57
1

Is msinfo32.exe still around (was as of 8.1)? Gives lots of handy info, including serial #'s and model numbers which can help a lot for laptops.

2
  • (if it is, it will be in the system summary area under OS Name up at the top.)
    – radiks32
    Aug 17, 2015 at 17:57
  • but it just starts the GUI and not a command line solution
    – phuclv
    Aug 9, 2018 at 7:43
1

You can pull the version from the registry. Here is a PowerShell snipit to do that:

function Get-RegistryValue($key, $value) {
(Get-ItemProperty $key $value).$value
}
$a1 = Get-RegistryValue "HKLM:\software\microsoft\windows nt\currentversion" CurrentBuild
$a2 = Get-RegistryValue "HKLM:\software\microsoft\windows nt\currentversion" UBR
Write-Host Version $a1'.'$a2
0

In an AD domain, you can use PowerShell's Get-ADComputer cmdlet

Get-ADComputer -Filter {OperatingSystem -eq "Windows 10 Pro"} -Property * | Format-Table Name,OperatingSystem,OperatingSystemVersion -Wrap -Auto
0

You can use Reg Query in a FOR command to get the Buildversion, for example, 1607:

for /f "usebackq skip=2 tokens=3" %f in (`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ReleaseID`) do (set buildver=%f)
1
0

In trying to find a way to display Windows 10 version and its revision for a single remote computer, I noticed that the PowerShell's version revision followed the Windows revision.

It led me to build the following script. I added a test to know if the remote computer needs to restart for update completion.

$OSChecked = (Read-Host "Computer Name?")
if (Test-Connection -ComputerName $OSChecked -Count 1 -ErrorAction SilentlyContinue)
{
    if ($((Get-Service WinRM -ComputerName $OSChecked).Status) -eq "stopped")
    {
        (Get-Service WinRM -ComputerName $OSChecked).Start()
    }
    Write-Host "`n$((Get-WmiObject win32_computersystem -ComputerName $OSChecked).Name) " -NoNewline ; Invoke-Command -ComputerName $OSChecked -ScriptBlock{if (Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -ErrorAction SilentlyContinue) {Write-Host "Restart Required!" -BackgroundColor DarkYellow -ForegroundColor White}}
    Invoke-Command -ComputerName $OSChecked -ScriptBlock{Write-Host "Version $((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ProductName) $((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ReleaseId), revision $(($PSVersionTable).PSVersion.Revision)"}
}

This gives this type of result:

Computer_Name Version Windows 10 Enterprise 1703, revision 296

In an AD domain, you may replace your single <Computer_Name> by a variable that contains the whole computers of an OU.

2
  • why do you write such a complex script? It doesn't work on my local PC which is not joined into any domains. And asking users to type the computer name is not friendly. It seems the only important command here is Write-Host "Version $((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ProductName) $((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").ReleaseId), revision $(($PSVersionTable).PSVersion.Revision)", but it gives me Windows 10 Pro 1803, revision 1000 on 10.0.17730.1000 which is incorrect. The build version is 17730
    – phuclv
    Aug 9, 2018 at 7:41
  • Apparently you have two Super User accounts: Frantz Kopanicki and Frantz Kopanicki. This will interfere with commenting, editing your own posts, and accepting an answer. Please take the time to utilise this Help Center tutorial and ask the Super User staff to merge your accounts.
    – robinCTS
    Aug 16, 2018 at 9:23
-1

We need to verify which cumulative patch is installed for compliance. using get-hotfix works but causes problems if a later cumulative patch is installed. The best solution is to compare the build number, including the hotfix portion. The only way to get that by command line is to use the command prompt ver command which doesn't work directly in PowerShell.

$verstring = cmd.exe /c ver
[version]$Winbuild = [regex]::Match($verstring,"(\d+\.\d+\.\d+\.\d+)").value
if ($verstring -ge [version]"10.0.16299.755") {write-host "Compliant"}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .