Sunday, October 18, 2009

RDP - Default Printer problem - Myob on SBS2003 - Printer Error 5

If your getting printer error no 5 in Myob, and your using TS on an SBS2003 box, then chances are this will help you.

You need to create a batch file in your users startup folder, or call it how you want.

The batch files contents should read:

NET STOP SPOOLER
NET START SPOOLER
E:\defprn.vbs

Obviously you need to tell us where the VBS file is.
The VBS file needs to read as follows (change name of default printer to what you want, or it will not work):

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

Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where Name = 'Kyocera Mita KM-4035 KX'")

For Each objPrinter in colInstalledPrinters
objPrinter.SetDefaultPrinter()
Next

Don't forget get to save the VBS file somewhere and call it in your start up batch file.

This fix forces the Printer Spooler to restart, and then calls a script to set a default printer, so that MYOB won't give you the error you are getting.

Credit for the VBS script and idea to: http://windows.ittoolbox.com/groups/technical-functional/windows-xp-pro-l/batch-file-to-set-default-printer-1324021

Cheers, josh

No comments: