This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Adding a Printer using a Custom Action on Windows 7 - Access Denied
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 16, 2011
07:15 PM
Adding a Printer using a Custom Action on Windows 7 - Access Denied
I am having an issue with a Custom Action that Adds a Printer.
The CA calls cscript to run the standard prnmngr.vbs script to do this.
The CA is scheduled to run Deferred in System Context.
The problem is that the installation works fine on Vista 32-bit (UAC disabled) and adds the printer to the system properly.
On Windows 7 64-bit however, the VBscript runs, but fails with a 0x80041003 Access Denied error and is unable to add the printer.
Googling this error code indicates that it is caused by insufficient permissions to invoke WMI to add the printer.
My Basic MSI release is set up to require Administrator priviledges, but I suspect that Windows Installer 4.5 is not running cscript "As Administrator" so it is unable to add the printer.
I suspect this because running the cscript command to add the printer from an Administrator command prompt window works fine on this Windows 7 machine.
The strange thing is that if I add the printer manually, my Uninstall is able to remove the printer just fine by running a similar deferred cscript custom action!
What's going on here? Has anybody seen this before?
Is there a way to deal with this for Windows 7 installations?
The CA calls cscript to run the standard prnmngr.vbs script to do this.
The CA is scheduled to run Deferred in System Context.
The problem is that the installation works fine on Vista 32-bit (UAC disabled) and adds the printer to the system properly.
On Windows 7 64-bit however, the VBscript runs, but fails with a 0x80041003 Access Denied error and is unable to add the printer.
Googling this error code indicates that it is caused by insufficient permissions to invoke WMI to add the printer.
My Basic MSI release is set up to require Administrator priviledges, but I suspect that Windows Installer 4.5 is not running cscript "As Administrator" so it is unable to add the printer.
I suspect this because running the cscript command to add the printer from an Administrator command prompt window works fine on this Windows 7 machine.
The strange thing is that if I add the printer manually, my Uninstall is able to remove the printer just fine by running a similar deferred cscript custom action!
What's going on here? Has anybody seen this before?
Is there a way to deal with this for Windows 7 installations?
(3) Replies
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 16, 2011
09:22 PM
Run 64-bit VBScripts code or 32-bit VBScripts code?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 16, 2011
10:59 PM
The CA runs c:\windows\sysWOW64\cscript.exe to run the script file.
My understanding is that the CA should be running in an elevated sandbox, which should behave the same as when I run the same script from a Run As Administrator Command Prompt.
Why do the WMI calls fail from the msi but they work from the command prompt?
My understanding is that the CA should be running in an elevated sandbox, which should behave the same as when I run the same script from a Run As Administrator Command Prompt.
Why do the WMI calls fail from the msi but they work from the command prompt?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 19, 2011
12:50 PM
I have been unable to determine why my elevated custom action does not have the necessary permissions to create a printer using prnmngr.vbs.
Since I use a similar CA to delete a printer during uninstall, which works, I have to assume that this is a bug in Windows 7 and/or Windows Installer 4.5.
Meanwhile, I've resorted to running the same script to add a printer as an Installshield prerequisite to get around this problem.
This works.
I still would love to find out why this can't work from an elevated MSI CA.
(I guess Windows Installer doesn't "elevate" permissions enough.)
Since I use a similar CA to delete a printer during uninstall, which works, I have to assume that this is a bug in Windows 7 and/or Windows Installer 4.5.
Meanwhile, I've resorted to running the same script to add a printer as an Installshield prerequisite to get around this problem.
This works.
I still would love to find out why this can't work from an elevated MSI CA.
(I guess Windows Installer doesn't "elevate" permissions enough.)