×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How to get name of the installed MS Office Software (not the version)

How to get name of the installed MS Office Software (not the version)

How to get name of the installed MS Office Software (not the version)

(OP)
Hi all,

actually I am using the following function down below within my vbs to get information about the actual installed MS Office software. But the full name of the installed office software eg. "Microsoft Office Professional Plus 2016" is not a result of my query I set it on my own depeding on what registry key is found and that's bullshit. The registry key only says that it is Version 16.0 or 15.0 and does not deliver the Office Edition (Professional or Professional Plus). Does anyone know how to get the complete name including the edition (from local computer)?

This is my function

Function GetOfficeVer()

sRegPre = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\"
sRegPost1 = "\Common\FilesPaths\"
sRegPost2 = "\Common\InstallRoot\"
Select Case True
Case RegKeyExists(sRegPre & "16.0" & sRegPost1)
sOfficeVer = "MS Office Professional Plus 2016"
Case RegKeyExists(sRegPre & "15.0" & sRegPost2)
sOfficeVer = "MS Office Professional Plus 2013"
Case Else
sOfficeVer = "Office not installed"
End Select
GetOfficeVer = sOfficeVer
End Function

RE: How to get name of the installed MS Office Software (not the version)

Refer to this link ==> VBS or Bat - Determine OS and Office Version

CODE --> Vbscript

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
	Wscript.Echo objOperatingSystem.Caption
Next

Set colSoft = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name Like 'Microsoft Office%'")

If colSoft.Count = 0 Then
	wscript.echo "NO OFFFICE INSTALLED" 
else
	For Each objItem In colSoft
		Wscript.echo objitem.caption & ", Version" & Left(objItem.Version, InStr(1,objItem.Version,".")-1)
		exit for
	Next
End If 

RE: How to get name of the installed MS Office Software (not the version)

a) Sadly this will not provide what the OP asks for: the full name of the installed office software eg. "Microsoft Office Professional Plus 2016"
b) "SELECT * FROM Win32_Product" is not advised if it can be avoided as it has some (sometimes serious) side effects, and also is slowwww due to the way it works (see the warning section in the Microsoft documentation

*Edited for clarity*
An alternative WMI technique involving a simple registry read of HKLM\Software via VBS is also prone to apparently incorrect results, since by default even on a 64bit platform VBS runs as 32bit, and thus only has access to 32bit nodes in registry - and the uninstall keys we want for Office are in the 64bit node

We can get around this, by using a slightly non-standard method of invoking WMI, e.g.

CODE

    strComputer = "."
    Const HKLM = &H80000002
    Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
    objCtx.Add "__ProviderArchitecture", 64 ' 32bit or 64bit node
    Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
    Set objServices = objLocator.ConnectServer(strComputer, "root\default", "", "", , , , objCtx)
    Set objStdRegProv = objServices.Get("StdRegProv")
    
    Set Inparams = objStdRegProv.Methods_("EnumKey").Inparameters
    Inparams.Hdefkey = HKLM
    Inparams.Ssubkeyname = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
    Set outparams = objStdRegProv.ExecMethod_("EnumKey", Inparams, , objCtx)

    arrSubkeys = outparams.sNames 

    Set Inparams = objStdRegProv.Methods_("GetStringValue").Inparameters
    Inparams.Hdefkey = HKLM
    Inparams.Svaluename = "DisplayName"
    For lp = 0 To UBound(arrSubkeys) - 1
        Inparams.Ssubkeyname = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & arrSubkeys(lp)
        Set outparams = objStdRegProv.ExecMethod_("GetStringValue", Inparams, , objCtx)
        If InStr(outparams.sValue, "Office") Then MsgBox outparams.sValue
    Next

 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close