Get-OSSku.ps1

Nitin Bhat the WMI PM recently pointed HERE to answer the question, how do know what OS SKU a machine is running?


You can run the expression $((gwmi win32_operatingsystem).OperatingSystemSKU) to the the value and then look it up on that table.


I decided to turn it into a script you can use.  It is rock-simple but it saves you the typing and there’s some value in that.  I’ve included it below and attached it as well.


Jeffrey Snover [MSFT]
Windows Management Partner Architect
Visit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx


$sku = $((gwmi win32_operatingsystem).OperatingSystemSKU)
switch ($sku)
{
    0       {“Undefined”;break}
    1       {“Ultimate Edition”;break}
    2       {“Home Basic Edition”;break}
    3       {“Home Basic Premium Edition”;break}
    4       {“Enterprise Edition”;break}
    5       {“Home Basic N Edition”;break}
    6       {“Business Edition”;break}
    7       {“Standard Server Edition”;break}
    8       {“Datacenter Server Edition”;break}
    9       {“Small Business Server Edition”;break}
    10       {“Enterprise Server Edition”;break}
    11       {“Starter Edition”;break}
    12       {“Datacenter Server Core Edition”;break}
    13       {“Standard Server Core Edition”;break}
    14       {“Enterprise Server Core Edition”;break}
    15       {“Enterprise Server Edition for Itanium-Based Systems”;break}
    16       {“Business N Edition”;break}
    17       {“Web Server Edition”;break}
    18       {“Cluster Server Edition”;break}
    19       {“Home Server Edition”;break}
    20       {“Storage Express Server Edition”;break}
    21       {“Storage Standard Server Edition”;break}
    22       {“Storage Workgroup Server Edition”;break}
    23       {“Storage Enterprise Server Edition”;break}
    24       {“Server For Small Business Edition”;break}
    25       {“Small Business Server Premium Edition”;break}
    default {“<UNKNOWN:$SKU>”}
}

Get-OSSKU.ps1