You're doing all this under an elevated prompt, right?
*ASB **http://XeeMe.com/AndrewBaker* <http://xeeme.com/AndrewBaker> *Providing Virtual CIO Services (IT Operations & Information Security) for the SMB market...* On Mon, Mar 31, 2014 at 9:39 PM, Ben Scott <[email protected]> wrote: > SUMMARY > > I'm trying to script creation of a local printer object on Windows > 7, and I keep getting a bogus error about the driver not being > available. But if I add the printer in the GUI, it works just fine. > > ENVIRONMENT > > Win 7 Pro SP1 64-bit > PDFCreator 0.9.8 > > BACKGROUND > > Our ERP system needs a printer object named "GSView". When that > object is printed to, a PDF is created, and then a post-processing > command is run to view and possibly save/print said PDF. > > To make this happen, we use the PDFCreator printer driver and the > included REDMON port monitor. We name the local port "GSView:". I > use a script to create the printer object. This worked fine on XP, > but is not cooperating on Win 7. > > PDFCreator is already installed and -- as far as I can tell -- > working fine. There are newer releases of PDFCreator, but I've been > avoiding updating because the publisher got into the suspicious > software components game (possible adware/spyware/etc.). The release > we have is clean. > > INVESTIGATION > > My first attempt was to use the PrnMngr.VBS that's included in > Windows 7 (under %SystemRoot%\System32\Printing_Admin_Scripts\en-en\). > It follows the same syntax as on XP (and it is what we use there). > The command I try is: > > CSCRIPT PrnMngr.VBS -a -m PDFCreator -p GSView -r GSView: > > When run, that spits out the following error: > > Unable to add printer GSView Error 0x80041001 Generic failure > Operation PutInstance > Provider Win32 Provider > Description The printer driver is unknown. > Win32 error code 1797 > > The error says the driver is unknown, but I can't see why it thinks > that. There is a working "PDFCreator" printer object already. If I > use "PrnMngr.VBS -l", I see the "PDFCreator" printer listed, with the > driver name "PDFCreator". If I use "PrnDrvr.VBS -l", I see the driver > listed there, too. The name is "PDFCreator,3,Windows x64". Normally > just the part before the first comma is used, but I tried passing the > whole thing (quoted) with the same results. (Without quotes, it > rejects the command line as invalid.) > > Plus, as I said, if I add the printer object in the GUI, it works just > fine. Print Management -> Print Servers -> local -> Printers, Add > Printer, existing port "GSView:", existing driver "PDFCreator". Boom, > it works. > > Likewise, Start -> Devices and Printers -> Add a printer -> local, > existing port "GSView:". PDFCreator isn't available as a driver, > because there's no INF, but if I add it as a "Generic Text Only", and > then use Printer Properties to change the driver to "PDFCreator" > (which is listed), it works. > > I also tracked down an alternate method, using this command: > > RUNDLL32 PRINTUI.DLL,PrintUIEntry /u /if /b GSView /r GSView: /m > PDFCreator > > That yields a GUII message box which says: > > Operation could not be completed (error > 0x000000705). Windows cannot locate a suitable > printer driver. Contact your administrator for help > locating and installing a suitable driver. > > This seems to be another way of saying the same thing as before. > > Anyone have any ideas on how to convince Windows that the driver > that's already installed is really, truly suitable? I interpret the > fact that it works in the GUI to mean it must be possible. > > -- Ben > > >

