{"id":70693,"date":"2005-01-10T10:02:00","date_gmt":"2005-01-10T10:02:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2005\/01\/10\/how-can-i-determine-which-version-of-word-is-installed-on-a-computer\/"},"modified":"2005-01-10T10:02:00","modified_gmt":"2005-01-10T10:02:00","slug":"how-can-i-determine-which-version-of-word-is-installed-on-a-computer","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/how-can-i-determine-which-version-of-word-is-installed-on-a-computer\/","title":{"rendered":"How Can I Determine Which Version of Word is Installed on a Computer?"},"content":{"rendered":"<p><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\"> \n<P>Hey, Scripting Guy! How can I determine which version of Word is installed on a computer?<BR><BR>&#8212; RR<\/P><IMG border=\"0\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" height=\"5\"><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\"><A href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><IMG class=\"farGraphic\" title=\"Script Center\" border=\"0\" alt=\"Script Center\" align=\"right\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" height=\"288\"><\/A> \n<P>Hey, RR. Turns out that this is a trickier question than you might expect. That\u2019s because WMI does only a so-so job of retrieving information about the software installed on a computer. In theory, you can use a script like this one to get back version information for Microsoft Office:<\/P><PRE class=\"codeSample\">strComputer = &#8220;.&#8221;\nSet objWMIService = GetObject(&#8220;winmgmts:\\\\&#8221; &amp; strComputer &amp; &#8220;\\root\\cimv2&#8221;)<\/p>\n<p>Set colApps = objWMIService.ExecQuery _\n    (&#8220;Select * from Win32_Product Where Caption Like &#8216;%Microsoft Office%'&#8221;)\nFor Each objApp in colApps\n    Wscript.Echo objApp.Caption, objApp.Version\nNext\n<\/PRE>\n<P>So why not just <I>use<\/I> that script? Well, two reasons. First, this script uses the <B>Like<\/B> operator; that operator is available only on Windows XP and Windows 2003. (And, just to complicate things, the Win32_Product class is <I>not<\/I> installed by default on Windows 2003.) If you\u2019re still running Windows 2000, you\u2019re out of luck. Instead, the best you could do is retrieve <I>all<\/I> the instances of the Win32_Product class, then check each instance to see if the caption includes the term <I>Microsoft Office<\/I>.<\/P>\n<P>Second, the preceding query returns information for any piece of software that has the term <I>Microsoft Office<\/I> somewhere in its name. You\u2019ll get the scoop on Microsoft Office Professional Edition 2003 all right, but you\u2019ll also get back information for applications like Microsoft Producer for Microsoft Office PowerPoint 2003. Consequently, you might have to further modify this script to ensure that you get back only information about the \u201creal\u201d Microsoft Office. <\/P>\n<P>And before you ask: yes, version information is stored in the registry, but, sadly, it\u2019s not always clear <I>where<\/I> in the registry to get this information. The location depends on the version of Office installed on a machine, as well as whether this was a clean install or an upgrade of an earlier version of Office. Which means that querying the registry to find out what version of Word is installed on a computer can also be a bit tricky, particularly in organizations where you are likely to have computers running different versions of Office.<\/P>\n<P>So then how the heck do you determine the version of Word installed on a computer? Well, after giving it a bit of thought, we decided the best way was to just ask Word. Here\u2019s a script that creates an instance of Microsoft Word, echoes back the version and build numbers, and then terminates that instance of Word:<\/P><PRE class=\"codeSample\">Set objWord = CreateObject(&#8220;Word.Application&#8221;)\nWscript.Echo &#8220;Version: &#8221; &amp; objWord.Version\nWscript.Echo &#8220;Build: &#8221; &amp; objWord.Build\nobjWord.Quit\n<\/PRE>\n<P>Four little lines of code, and pretty much guaranteed to work. On top of that, the instance of Word you create runs in an invisible window, so you won\u2019t even see Word pop up on the screen. What more could you ask for?<\/P>\n<P>If you want to find out the version of Word installed on a remote computer, just add that computer name as the optional second parameter passed to CreateObject. This modified script grabs the version of Word installed on the remote computer atl-ws-01:<\/P><PRE class=\"codeSample\">Set objWord = CreateObject(&#8220;Word.Application&#8221;, &#8220;atl-ws-01&#8221;)\nWscript.Echo &#8220;Version: &#8221; &amp; objWord.Version\nWscript.Echo &#8220;Build: &#8221; &amp; objWord.Build\nobjWord.Quit\n<\/PRE>\n<P>Sure, it might seem like overkill, but ultimately this approach should prove easier and more reliable than using Win32_Product or trying to grab version information from the registry.<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, Scripting Guy! How can I determine which version of Word is installed on a computer?&#8212; RR Hey, RR. Turns out that this is a trickier question than you might expect. That\u2019s because WMI does only a so-so job of retrieving information about the software installed on a computer. In theory, you can use a [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[458,3,5,288],"class_list":["post-70693","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-applications","tag-scripting-guy","tag-vbscript","tag-version-information"],"acf":[],"blog_post_summary":"<p>Hey, Scripting Guy! How can I determine which version of Word is installed on a computer?&#8212; RR Hey, RR. Turns out that this is a trickier question than you might expect. That\u2019s because WMI does only a so-so job of retrieving information about the software installed on a computer. In theory, you can use a [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/70693","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=70693"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/70693\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=70693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=70693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=70693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}