Error when trying to use WSF TypeLib reference to "WindowsInstaller.Installer"? Help!

  • Thread starter Thread starter news.microsoft.com
  • Start date Start date
N

news.microsoft.com

[This is really a WSH question as much as an MSI question, which is why I'm
cross-posting.]

I have a number of VBscripts which are organised under an WSF file and run
by the Windows Scripting Host. The VBScript use the Windows Installer COM
API.

I'd like to add a reference to the "WindowsInstaller.Installer" object so
that I can use the constants defined in the MSI TypeLib. I've done this for
other object models before, but not MSI.

Anyway, when I attempt to add a reference either using the ProgID or GUID

<reference id="Microsoft Windows Installer Object Library"
object="WindowsInstaller.Installer"/>
OR:
<reference id="Microsoft Windows Installer Object Library 1.0"
guid="{000C1092-0000-0000-C000-000000000046}"/>

I get this error when I call the script using CScript.exe:

MSILibrary.wsf(0, 1) Win
Cannot add reference : {000C1092-0000-0000-C000-000000000046}

I'm on Windows XP. Does anybody have any ideas?

Alastair
 
Not sure how you have setup things. But putting the following in a wsf file
will work(at least on my Win2K machine)

<package>
<job id="Job1">
<reference object="WindowsInstaller.Installer"/>
<script language="VBScript">
'this should return 4
msgbox "msiViewModifyReplace=" & msiViewModifyReplace
</script>
</job>
</package>

--

Regards,
Sajan.

PS: Please don't send me direct emails, use the newsroom.
 
Not sure how you have setup things. But putting the following in a wsf file
will work(at least on my Win2K machine)

<package>
<job id="Job1">
<reference object="WindowsInstaller.Installer"/>
<script language="VBScript">
'this should return 4
msgbox "msiViewModifyReplace=" & msiViewModifyReplace
</script>
</job>
</package>

--

Regards,
Sajan.

PS: Please don't send me direct emails, use the newsroom.
 
Unfortunately, your simple example generates the same error ("cannot add
reference {GUID}") on this computer as I had with my more complicated
example.

It's a WinXP computer, and I can install software so I know the installer
service is working; I can also createobject ("WindowsInstaller.Installer")
so I know MSI.DLL is registered and late-binding is working.

I have no idea what could be causing this problem. Maybe it's an
early-binding issue; something to do with the script engine attempting to
get a reference to the TypeLib?

Very strange. I've solved it by declaring the Windows Installer constants in
a common.vbs which is included with every .vbs job in a package;

*HOWEVER* I'd still like to know what is causing the error because I'd like
to use <reference> instead.

Alastair

Kallely Sajan said:
Not sure how you have setup things. But putting the following in a wsf file
will work(at least on my Win2K machine)

<package>
<job id="Job1">
<reference object="WindowsInstaller.Installer"/>
<script language="VBScript">
'this should return 4
msgbox "msiViewModifyReplace=" & msiViewModifyReplace
</script>
</job>
</package>

--

Regards,
Sajan.

PS: Please don't send me direct emails, use the newsroom.

news.microsoft.com said:
[This is really a WSH question as much as an MSI question, which is why I'm
cross-posting.]

I have a number of VBscripts which are organised under an WSF file and run
by the Windows Scripting Host. The VBScript use the Windows Installer COM
API.

I'd like to add a reference to the "WindowsInstaller.Installer" object so
that I can use the constants defined in the MSI TypeLib. I've done this for
other object models before, but not MSI.

Anyway, when I attempt to add a reference either using the ProgID or GUID

<reference id="Microsoft Windows Installer Object Library"
object="WindowsInstaller.Installer"/>
OR:
<reference id="Microsoft Windows Installer Object Library 1.0"
guid="{000C1092-0000-0000-C000-000000000046}"/>

I get this error when I call the script using CScript.exe:

MSILibrary.wsf(0, 1) Win
Cannot add reference : {000C1092-0000-0000-C000-000000000046}

I'm on Windows XP. Does anybody have any ideas?

Alastair
 
news.microsoft.com said:
Unfortunately, your simple example generates the same error ("cannot
add reference {GUID}") on this computer as I had with my more
complicated example.


??? Kallely's example also works OK for me on W2K Pro sp3...


--
Michael Harris
Microsoft.MVP.Scripting

Windows 2000 Scripting Guide
Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp

TechNet Script Center Sample Scripts
http://www.microsoft.com/downloads/release.asp?ReleaseID=38942

WSH 5.6 documentation download
http://www.microsoft.com/downloads/...48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en
 
Same thing for me on XPSP1; works fine.

<package>
<job id="Job1">
<reference object="WindowsInstaller.Installer"/>
<script language="VBScript"><![CDATA[
'this should return 4
msgbox "msiViewModifyReplace=" & msiViewModifyReplace
]]></script>
</job>
</package>
 
Back
Top