Get Windows Version from Command Line



  • It can be quick and easy to get your current Windows release from the command line. Often way faster than in the GUI, if you know where to look in the registry. Here is a quick command to query the registry and find out which OS version you are currently running. Since going to Windows 10, the OS version is often buried so this is far more useful than it used to be.

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




  • @black3dynamite said in Get Windows Version from Command Line:

    https://www.windows-commandline.com/find-windows-os-version-from-command/
    ver

    ver is nice if you know the patch level you want, rather than the OS version.



  • @scottalanmiller said in Get Windows Version from Command Line:

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

    I lke the results of this better:
    systeminfo | findstr /B /C:"OS Name" /C:"OS Version"

    C:\Windows\system32>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
    OS Name: Microsoft Windows Server 2016 Standard
    OS Version: 10.0.14393 N/A Build 14393

    but your version does provide the update version! ie; 1607



  • Winver

    Commandline, even though the results are in a gui window.

    Much easier to remember than a whole line of code.



  • @Vlinderbeest said in Get Windows Version from Command Line:

    Winver

    Commandline, even though the results are in a gui window.

    Much easier to remember than a whole line of code.

    That's best if you have a GUI. 95% of the time, I do not, just run from a remote terminal. So the pure CLI version is necessary for me.



  • I use this PowerShell method, because it's more accurate when needing bulid/release version and patch level: Get-WUAVersion

    However, I do understand the possiblility of running into Windows versions that may not have some PowerShell modules and may not be able to automatically obtain it in the script, requiring CMD.

    Versus just the release. I guess it depends on what you're after, but I always like having the release and patch level.

    e22ca650-b100-49e4-9f1f-1205a6288325-image.png

    Which, you just learn after a second, or can reference ths chart:

    https://en.wikipedia.org/wiki/Windows_10_version_history
    0a25e0e3-8530-4087-9b23-4880ac0e3f9c-image.png



  • @Obsolesce said in Get Windows Version from Command Line:

    However, I do understand the possiblility of running into Windows versions that may not have some PowerShell modules and may not be able to automatically obtain it in the script, requiring C

    As I start to learn a little more about PowerShell, this has become one of my most aggravating issues.

    The 2nd is not having some of the same cmdlets on Server version vs Desktop version for the same feature/function (don't know the right verbiage).



  • @pmoncho said in Get Windows Version from Command Line:

    @Obsolesce said in Get Windows Version from Command Line:

    However, I do understand the possiblility of running into Windows versions that may not have some PowerShell modules and may not be able to automatically obtain it in the script, requiring C

    As I start to learn a little more about PowerShell, this has become one of my most aggravating issues.

    The 2nd is not having some of the same cmdlets on Server version vs Desktop version for the same feature/function (don't know the right verbiage).

    Understable, but avoidable when deployment standards are implemented, or kept among all systems uniformity is needed.

    For example, we didn't run into that issue in my last environment because we made sure all systems met any requirements first, such as PS 5.1 and other things we needed for ease of administration and management.



  • @Obsolesce said in Get Windows Version from Command Line:

    @pmoncho said in Get Windows Version from Command Line:

    @Obsolesce said in Get Windows Version from Command Line:

    However, I do understand the possiblility of running into Windows versions that may not have some PowerShell modules and may not be able to automatically obtain it in the script, requiring C

    As I start to learn a little more about PowerShell, this has become one of my most aggravating issues.

    The 2nd is not having some of the same cmdlets on Server version vs Desktop version for the same feature/function (don't know the right verbiage).

    Understable, but avoidable when deployment standards are implemented, or kept among all systems uniformity is needed.

    For example, we didn't run into that issue in my last environment because we made sure all systems met any requirements first, such as PS 5.1 and other things we needed for ease of administration and management.

    You'd be crazy to not standardize like that at any given company. Problem is, a lot of us are in the consulting business and don't know what sort of environment we'll be walking into on any given day. What works at one place is horribly broken at another.



  • @Obsolesce

    I get that. Currently, I don't know what I don't know so I need to learn how to know what I need to know that will solve the current "not knowing what I don't know" situation. 😉



  • @travisdh1 said in Get Windows Version from Command Line:

    Problem is, a lot of us are in the consulting business and don't know what sort of environment we'll be walking into on any given day. What works at one place is horribly broken at another.

    Ya, but that's a whole separate issue.



  • @pmoncho said in Get Windows Version from Command Line:

    @Obsolesce said in Get Windows Version from Command Line:

    However, I do understand the possiblility of running into Windows versions that may not have some PowerShell modules and may not be able to automatically obtain it in the script, requiring C

    As I start to learn a little more about PowerShell, this has become one of my most aggravating issues.

    The 2nd is not having some of the same cmdlets on Server version vs Desktop version for the same feature/function (don't know the right verbiage).

    Yeah, the vast differences from version to version or machine to machine is crazy. What works in one place doesn't in another, what worked for a year suddenly breaks, what's available on 90% of machines is missing on 10%, and the recommended components that everyone raves about are often not part of PS at all but are a non-Windows add in called PS Core, that while pretty cool, isn't a part of any Windows release.



  • @Obsolesce said in Get Windows Version from Command Line:

    Understable, but avoidable when deployment standards are implemented, or kept among all systems uniformity is needed.

    That's the thing, it's not like that in non-Windows environments, or Windows when not using PowerShell. There are differences, but they are usually tiny. Most CMD tools, for example, like the net commands, have stayed uniform for decades. PS hasn't stayed uniform for even a couple years.

    It's absolutely avoidable. Useradd on Linux, for example, isn't just uniform on Fedora or Ubuntu, and not just across Linux, but across nearly all UNIX!

    That's why people find this frustrating. Things that aren't challenges in other ecosystems, and weren't historically on Windows, suddenly are. The level of what is considered acceptable has been slipping.



  • @pmoncho said in Get Windows Version from Command Line:

    @Obsolesce

    I get that. Currently, I don't know what I don't know so I need to learn how to know what I need to know that will solve the current "not knowing what I don't know" situation. 😉

    That's kind of the Windows thing now - It's constantly changing so no one knows what they need to know. Every release is making for all new challenges.



  • @scottalanmiller said in Get Windows Version from Command Line:

    @pmoncho said in Get Windows Version from Command Line:

    @Obsolesce

    I get that. Currently, I don't know what I don't know so I need to learn how to know what I need to know that will solve the current "not knowing what I don't know" situation. 😉

    That's kind of the Windows thing now - It's constantly changing so no one knows what they need to know. Every release is making for all new challenges.

    No doubt. Currently working on getting Server 2019 DC, DHCP, and RDS working in a lab. A few challenges so far. Was going to try using PS to do many tasks I normally do in GUI (force myself to learn as I go) but decided to put it on the back burner due to frustration. I will get there with PS but it has to wait.



  • @pmoncho said in Get Windows Version from Command Line:

    No doubt. Currently working on getting Server 2019 DC, DHCP, and RDS working in a lab. A few challenges so far. Was going to try using PS to do many tasks I normally do in GUI (force myself to learn as I go) but decided to put it on the back burner due to frustration. I will get there with PS but it has to wait.

    Unfortunately, no matter how much we want to complain about PS and how Windows has no production-level roadmap at this point and is getting worse by the day, if you are going to run Windows today, PS is how it is done. Issues with PS have only one valid purpose to discuss - to use to explain to management why Windows shouldn't be getting deployed in production workloads, or why risks with it need to be accepted. It's like the licensing issues with Windows, these things all add up to cost and risk and risk is really just cost. It's part of the "decision numbers." Beyond that, it is what it is. If the business actually knows how costly it is and still chooses it, then PS is how you manage it.

    If you deploy and start without using PS, it'll be that much harder to switch later. I know the learning curve is absurd and the whole thing is so much harder than it has any purpose being, but I would bite the bullet if at all possible and learn it now. It'll just be harder later.