PowerTip: Use PowerShell to Find Windows Version


Summary: Use Windows PowerShell to find what version of Windows you are running.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find the version of Windows that is installed on a group of computers?
           To be safe, I need the command to be compatible with Windows PowerShell  2.0.

Hey, Scripting Guy! Answer Use the Get-WmiObject cmdlet and query the Win32_OperatingSystem WMI class:

(Get-WmiObject win32_operatingsystem).version

Comments (3)

  1. James A. Brown says:

    Checking the caption gets you a plain-language description of your Windows version, not a number that you’d have to look up in a table somewhere:

    (Get-WmiObject win32_operatingsystem).caption

  2. ME says:

    @James
    Unfortunately the caption does not contain version information it only contains the product name. A version number looks like this: 6.3.3900 That is a version number and t is not in the caption. The caption only says: "Microsoft Windows 7 Professional". No
    version number there.

  3. James A. Brown says:

    Oh, true enough. For me, however, in my shop, when someone asks "What version of Windows is on that computer?" the answer is typically, "Windows 2008 Server," or "Windows 2012", etc. If I replied, "It’s version 6.3.3900" one of us would have to look up
    the actual version from a table in TechNet or Wikipedia.

    I guess it comes down to, is there a difference between an Operating System *Version* and a version *number*?

Skip to main content