{"id":5931,"date":"2008-06-13T23:56:00","date_gmt":"2008-06-13T23:56:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2008\/06\/13\/get-ossku-ps1\/"},"modified":"2019-02-18T13:13:12","modified_gmt":"2019-02-18T20:13:12","slug":"get-ossku-ps1","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/get-ossku-ps1\/","title":{"rendered":"Get-OSSku.ps1"},"content":{"rendered":"<p>Nitin Bhat the WMI PM recently pointed <a class=\"\" href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/aa394239.aspx\">HERE<\/a> to answer the question, how do know what OS SKU a machine is running?<\/p>\n<p>You can run the expression <span>$((gwmi win32_operatingsystem).OperatingSystemSKU) to the the value and then look it up on that table.<\/span><\/p>\n<p><span>I decided to turn it into a script you can use.&nbsp; It is rock-simple but it saves you the typing and there&#8217;s some value in that.&nbsp; I&#8217;ve included it below and attached it as well.<\/span><\/p>\n<p><span>Jeffrey Snover [MSFT]<br \/>Windows Management Partner Architect<br \/>Visit the Windows PowerShell Team blog at:&nbsp;&nbsp;&nbsp; <a href=\"http:\/\/blogs.msdn.com\/PowerShell\">http:\/\/blogs.msdn.com\/PowerShell<\/a><br \/>Visit the Windows PowerShell ScriptCenter at:&nbsp; <a href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\">http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx<\/a><br \/><\/span><\/p>\n<p><span>$sku = $((gwmi win32_operatingsystem).OperatingSystemSKU)<br \/>switch ($sku)<br \/>{<br \/>&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Undefined&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Ultimate Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Home Basic Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Home Basic Premium Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Enterprise Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Home Basic N Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Business Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Standard Server Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Datacenter Server Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Small Business Server Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Enterprise Server Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Starter Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Datacenter Server Core Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 13&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Standard Server Core Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 14&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Enterprise Server Core Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Enterprise Server Edition for Itanium-Based Systems&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Business N Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 17&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Web Server Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 18&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Cluster Server Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 19&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Home Server Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Storage Express Server Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 21&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Storage Standard Server Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 22&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Storage Workgroup Server Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 23&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Storage Enterprise Server Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 24&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Server For Small Business Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; 25&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&#8220;Small Business Server Premium Edition&#8221;;break}<br \/>&nbsp;&nbsp;&nbsp; default {&#8220;&lt;UNKNOWN:$SKU&gt;&#8221;}<br \/>}<\/p>\n<p><\/span><\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Components.PostAttachments\/00\/08\/59\/58\/41\/Get-OSSKU.ps1\">Get-OSSKU.ps1<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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.&nbsp; It is rock-simple [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[26],"class_list":["post-5931","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-wmi"],"acf":[],"blog_post_summary":"<p>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.&nbsp; It is rock-simple [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/5931","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=5931"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/5931\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=5931"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=5931"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=5931"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}