ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Get Windows Version from Command Line

    IT Discussion
    cli command line windows sam windows administration system administration windows 10 registry
    7
    17
    1.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      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
      
      1 Reply Last reply Reply Quote 1
      • black3dynamiteB
        black3dynamite
        last edited by

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

        scottalanmillerS 1 Reply Last reply Reply Quote 1
        • scottalanmillerS
          scottalanmiller @black3dynamite
          last edited by

          @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.

          1 Reply Last reply Reply Quote 0
          • J
            JasGot
            last edited by JasGot

            @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

            1 Reply Last reply Reply Quote 1
            • V
              Vlinderbeest
              last edited by Vlinderbeest

              Winver

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

              Much easier to remember than a whole line of code.

              scottalanmillerS 1 Reply Last reply Reply Quote 4
              • scottalanmillerS
                scottalanmiller @Vlinderbeest
                last edited by

                @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.

                1 Reply Last reply Reply Quote 0
                • ObsolesceO
                  Obsolesce
                  last edited by Obsolesce

                  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

                  pmonchoP 1 Reply Last reply Reply Quote 3
                  • pmonchoP
                    pmoncho @Obsolesce
                    last edited by

                    @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).

                    ObsolesceO scottalanmillerS 2 Replies Last reply Reply Quote 1
                    • ObsolesceO
                      Obsolesce @pmoncho
                      last edited by

                      @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.

                      travisdh1T pmonchoP scottalanmillerS 3 Replies Last reply Reply Quote 0
                      • travisdh1T
                        travisdh1 @Obsolesce
                        last edited by

                        @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.

                        ObsolesceO 1 Reply Last reply Reply Quote 2
                        • pmonchoP
                          pmoncho @Obsolesce
                          last edited by

                          @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. :winking_face:

                          scottalanmillerS 1 Reply Last reply Reply Quote 1
                          • ObsolesceO
                            Obsolesce @travisdh1
                            last edited by

                            @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.

                            1 Reply Last reply Reply Quote 0
                            • scottalanmillerS
                              scottalanmiller @pmoncho
                              last edited by

                              @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.

                              1 Reply Last reply Reply Quote 0
                              • scottalanmillerS
                                scottalanmiller @Obsolesce
                                last edited by

                                @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.

                                1 Reply Last reply Reply Quote 1
                                • scottalanmillerS
                                  scottalanmiller @pmoncho
                                  last edited by

                                  @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. :winking_face:

                                  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.

                                  pmonchoP 1 Reply Last reply Reply Quote 1
                                  • pmonchoP
                                    pmoncho @scottalanmiller
                                    last edited by

                                    @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. :winking_face:

                                    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.

                                    scottalanmillerS 1 Reply Last reply Reply Quote 0
                                    • scottalanmillerS
                                      scottalanmiller @pmoncho
                                      last edited by

                                      @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.

                                      1 Reply Last reply Reply Quote 3
                                      • 1 / 1
                                      • First post
                                        Last post