 {"id":13904,"date":"2019-12-02T01:27:00","date_gmt":"2019-12-02T08:27:00","guid":{"rendered":"https:\/\/moderneuc.com\/?p=13904"},"modified":"2026-02-18T13:02:24","modified_gmt":"2026-02-18T20:02:24","slug":"script-to-get-os-version","status":"publish","type":"post","link":"https:\/\/jorgep.com\/blog\/script-to-get-os-version\/","title":{"rendered":"Script to get OS version"},"content":{"rendered":"\n<p>I am surprised by the number of organizations still managing their many devices without a system management tool.     It may not be the most efficient way, but over the years they have developed processes  and procedures to manually (or semi-manually) keep up the environment running. <\/p>\n\n\n\n<p>With the introduction of Windows 10 these manual processes have been put to the test in order to keep up with the new <a href=\"https:\/\/jorgep.com\/blog\/keeping-up-with-windows-10\/\">Windows as A Service cadence<\/a>.   This is especially true or organization that have opted to stay with Windows 10 Pro.   <\/p>\n\n\n\n<p><strong>One question I have been asked often is if there is an easy way to gather the systems&#8217;s Windows 10 version and edition from the environment.<\/strong><\/p>\n\n\n\n<p>I think one of the simplest ways is using the  <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/wmisdk\/wmic\">Windows Management Interface Command <\/a> ( wmic ) which  is a command prompt tool available in most \/ all Windows OS platforms, that returns information about the system you are running it on.     wmic  has been around for many years, and is well know to savy system administrators.     There is a lot you can do with it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The command-line<\/h3>\n\n\n\n<p>The following command-line: <\/p>\n\n\n\n<p>wmic os get Caption, Version, BuildNumber, OSArchitecture,CSname<\/p>\n\n\n\n<p>produces the following output to the console (screen): <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">BuildNumber  Caption                          CSName   OSArchitecture  Version\n\n17134        Microsoft Windows 10 Enterprise  XY6V356  64-bit          10.0.17134<\/pre>\n\n\n\n<p>Finally the following command-line creates a CSV file  with the information above stated and write to a file with >> drive:\\filename.csv  .   <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">wmic os get Caption, Version, BuildNumber, OSArchitecture,CSname \/format:csv >> c:\\infofile.csv<\/pre>\n\n\n\n<p>It will look something like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Node,BuildNumber,Caption,CSName,OSArchitecture,Version\n DELL-E6330-01,18362,Microsoft Windows 10 Pro,DELL-E6330-01,64-bit,10.0.18362<\/pre>\n\n\n\n<p> You can change the file name to a shared drive and it will create an inventory of all of your devices.  <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Node,BuildNumber,Caption,CSName,OSArchitecture,Version\nY6V356 ,17134,Microsoft Windows 10 Enterprise,Y6V356,64-bit,10.0.17134\nNode,BuildNumber,Caption,CSName,OSArchitecture,Version\nDELL-E6330-01,18362,Microsoft Windows 10 Pro,DELL-E6330-01,64-bit,10.0.18362 <\/pre>\n\n\n\n<p>After you have ran it across your devices, you can import that file into excel and delete duplicates, format as needed, analyze and then take action as needed.<\/p>\n\n\n\n<p>Other ideas: <\/p>\n\n\n\n<p>How to get a list of installed software on the device:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>wmic product get name,version<\/code><\/pre>\n\n\n\n<p>Want to get a list of all users to a csv file or table?<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">wmic  useraccount list full \/format:csv\nwmic  useraccount list full \/format:table<\/pre>\n\n\n\n<p>As you can see, there are many options and info available with the wmic command-line utility. Below are some resources  you can read more about this powerful utility: <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a rel=\"noreferrer noopener\" aria-label=\"WMIC OS Get available commands (opens in a new tab)\" href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/cimwin32prov\/win32-operatingsystem\" target=\"_blank\">WMIC OS Get available commands<\/a><\/li><li><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"http:\/\/www.pearsonitcertification.com\/articles\/article.aspx?p=1700427&amp;seqNum=4\" target=\"_blank\">Modifying  wmic output with with the \/format switch<\/a><\/li><li><a rel=\"noreferrer noopener\" aria-label=\"Connecting to WMI on a Remote Computer (opens in a new tab)\" href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/wmisdk\/connecting-to-wmi-on-a-remote-computer\" target=\"_blank\">Connecting to WMI on a Remote Computer<\/a><\/li><li><a rel=\"noreferrer noopener\" aria-label=\"Complete WMI query guide with WMI Explorer, Powershell, CMD (opens in a new tab)\" href=\"https:\/\/www.optimizationcore.com\/system-administration\/complete-wmi-query-guide-wmiexplorer-powershell-cmd\/\" target=\"_blank\">Complete WMI query guide with WMI Explorer, Powershell, CMD<\/a><\/li><li><a href=\"https:\/\/www.moderndeployment.com\/create-azure-ad-dynamic-group-for-model-type-helpful-quick-guide\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Create Azure AD Dynamic Group for Model Type\u00a0 (opens in a new tab)\">Create Azure AD Dynamic Group for Model Type\u00a0<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I am surprised by the number of organizations still managing their many devices without a system management tool. It may not be the most efficient way, but over the years they have developed processes and procedures to manually (or semi-manually) keep up the environment running. With the introduction of Windows 10 these manual processes have&#8230;<\/p>\n","protected":false},"author":2,"featured_media":368761,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","ngg_post_thumbnail":0,"episode_type":"","audio_file":"","podmotor_file_id":"","podmotor_episode_id":"","cover_image":"","cover_image_id":"","duration":"","filesize":"","filesize_raw":"","date_recorded":"","explicit":"","block":"","itunes_episode_number":"","itunes_title":"","itunes_season_number":"","itunes_episode_type":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[681,441],"tags":[742,761,326,430],"class_list":["post-13904","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-moderneuc2","category-tech-talk","tag-moderneuc1","tag-script","tag-windows","tag-windows-10"],"taxonomy_info":{"category":[{"value":681,"label":"ModernEUC"},{"value":441,"label":"Tech Talk"}],"post_tag":[{"value":742,"label":"ModernEUC"},{"value":761,"label":"Script"},{"value":326,"label":"Windows"},{"value":430,"label":"Windows 10"}]},"featured_image_src_large":["https:\/\/jorgep.com\/blog\/wp-content\/uploads\/commandlineScript-Featured.jpg",730,430,false],"author_info":{"display_name":"Jorge Pereira","author_link":"https:\/\/jorgep.com\/blog\/author\/jorge\/"},"comment_info":0,"category_info":[{"term_id":681,"name":"ModernEUC","slug":"moderneuc2","term_group":0,"term_taxonomy_id":691,"taxonomy":"category","description":"","parent":0,"count":261,"filter":"raw","cat_ID":681,"category_count":261,"category_description":"","cat_name":"ModernEUC","category_nicename":"moderneuc2","category_parent":0},{"term_id":441,"name":"Tech Talk","slug":"tech-talk","term_group":0,"term_taxonomy_id":451,"taxonomy":"category","description":"","parent":0,"count":672,"filter":"raw","cat_ID":441,"category_count":672,"category_description":"","cat_name":"Tech Talk","category_nicename":"tech-talk","category_parent":0}],"tag_info":[{"term_id":742,"name":"ModernEUC","slug":"moderneuc1","term_group":0,"term_taxonomy_id":752,"taxonomy":"post_tag","description":"","parent":0,"count":284,"filter":"raw"},{"term_id":761,"name":"Script","slug":"script","term_group":0,"term_taxonomy_id":771,"taxonomy":"post_tag","description":"","parent":0,"count":2,"filter":"raw"},{"term_id":326,"name":"Windows","slug":"windows","term_group":0,"term_taxonomy_id":336,"taxonomy":"post_tag","description":"","parent":0,"count":90,"filter":"raw"},{"term_id":430,"name":"Windows 10","slug":"windows-10","term_group":0,"term_taxonomy_id":440,"taxonomy":"post_tag","description":"","parent":0,"count":78,"filter":"raw"}],"_links":{"self":[{"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/posts\/13904","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/comments?post=13904"}],"version-history":[{"count":1,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/posts\/13904\/revisions"}],"predecessor-version":[{"id":518863,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/posts\/13904\/revisions\/518863"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/media\/368761"}],"wp:attachment":[{"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/media?parent=13904"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/categories?post=13904"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jorgep.com\/blog\/wp-json\/wp\/v2\/tags?post=13904"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}