[THIN] Users can't assign default printers

  • From: "Rick Mack" <ulrich.mack@xxxxxxxxx>
  • To: thin@xxxxxxxxxxxxx
  • Date: Thu, 31 May 2007 06:55:53 +1000

Hi,

Had a bit of fun yesterday with an interesting printing problem.

The customer had set the site up themselves (not one of mine!) and things
had been going fairly well, except for one major annoyance. Printer
assignments were scripted and were obviously working, but Excel complained
that there was no printer present, despite Word etc being able to print fine
though you always had to select the printer.

All printers were standard network print shares on a single file/print
server. The Citrix servers were PS4, Windows Server 2003 SP1.

When I started looking it was obvious that the servers had been cloned from
a production image because the ctx_sma user permissions for DCOM and the ICA
listener were screwed up. Since that's going to have a negative effect on
printing, the first thing I did was fix all the permissions and DCOM login
information.

A reboot and the problem was still there.

When I tried to add a network printer via the printer and faxes applet, I
got the error "You do not have sufficient access to your computer to connect
to the selected printer". That's normally the error you get when the right
drivers aren't installed so I checked, and sure enough, the drivers
installed were all over the place.

A really quick way to suck all the drivers off a print server is a single
line command which uses con2prt from the NT resource kit:

for /f %i in ('net view \\printserver ^| find /i "print"') do con2prt /c
\\printserver\%i

Okay, all drivers were now loaded but I still got the error.

If I persisted in trying to create the printer connection, it actually
worked but came up with a new error, "Cannot set default printer". That was
a new one and I finally resorted to Google. I found a forum link that
pointed me to a KB article suggesting a corrupted registry key (no comment
on which one!) among other things. And of course a link to a Brian Madden
forum saying "that fixed it for me". But the link was dead 'cause Brian's
rebuilt the whole site :-(

So what could I do now that Google had let me down?

Find out what's happening of course. I used process monitor and looked at
explorer.exe, spoolsv.exe, rundll32.exe etc but it didn't show me anything
useful. No access denied etc. Everything I tried failed to point me in the
right direction and I kept thinking about the useless KB article that said
it might be a registry corruption.

So I started what was happening at the registry level when a user tried to
create a printer and assign it as a default.

All the connections stuff was happening okay under HKCU\Printers so that was
fine which made sense 'cause you could print (except from Excel).

The next step is that the default printer is defined under
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows, in a value,
Device.

But when I looked for the default printer value for a non-admin user, it
wasn't there. Matter of fact the whole Windows key wasn't there.

When I manually created the Windows key under
HKCU\Software\Microsoft\Windows NT\CurrentVersion for a user, the errors
went away and you could set your default printer. Excel was happy, the
customer was happy and so was I ;-)

The fix was 3 lines of script on login the checked whether the
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows key existed, and
if not create it.

A bit more research suggested that the problem could be an occasional result
of installing SP1.

So if you're "lucky" enough to see this problem, now you know how to fix it.

regards,

Rick

--
Ulrich Mack
Commander Australia

Other related posts: