Hello,
Has anyone done any scripting with Office 2007? My situation is that one of our clients is a law firm, which utilizes a lot of com add-ins and templates in Microsoft Word.
Our problem is that the add-ins/templates are constantly getting disabled within Word. I was tasked to see if it's possible to re-enable the add-ins/templates via scripting, or at least identify if their are any.
So I started exploring WMI. First using WMI security, I noticed their is a namespace called MSAPPS12, 12 being the version of Office 2007. Then using Primalscript's WMI Wizard I started enumerating the properties of different classes to see what I can find. However, the script was bringing back nothing, nothing was being echo'd to the window. So I removed the "On Error Resume Next" that is put in and now I get back the following error:
Script: Myscript.vbs
Line: 17
Char: 1
Error: 0x80041013
Code: 80041013
Source: (null)
It seems that there are no valid, or populating values for the properties. I've googled WMI Scripting Office 2007, in different variations but have no luck. Here is my script, which is just an exact copy of generated from WMI Wizard:
'On Error Resume NextDim strComputerDim objWMIServiceDim propValueDim objItemDim SWBemlocatorDim UserNameDim PasswordDim colItems
strComputer = "."UserName = ""Password = ""Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")Set objWMIService = SWBemlocator.ConnectServer(strComputer,"rootmsapps12",UserName,Password)Set colItems = objWMIService.ExecQuery("Select * from Win32_Word12Template",,48)For Each objItem in colItems WScript.Echo "Name: " & objItem.Name WScript.Echo "Path: " & objItem.Path WScript.Echo "Type: " & objItem.TypeNext
If anyone has any ideas that would be great. Thanks.
Office 2007 WMI Scripting
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Office 2007 WMI Scripting
Here is another that should work:
You need to change the MSAPPS11 to MSAPPS12
You need to change the MSAPPS11 to MSAPPS12
Code: Select all
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & strComputer & "rootMSApps11")
Set colSettings = objWMIService.ExecQuery ("Select * from Win32_OutlookCOMAddin")
For Each strSetting in colSettings
Wscript.Echo "GUID: " & strSetting.GUID
Wscript.Echo "Path: " & strSetting.Path
Wscript.Echo "Name: " & strSetting.Name
Wscript.Echo "Installed: " & strSetting.Installed
Wscript.Echo
Next