Jump to content

Recommended Posts

Posted

Hi I have a small problem with printers on a network

Recently I have upgraded to windows server 2003 R2 and have setup the Printer Management Console. By using the pushprinterconnections.exe in the computer startup policy I have added the printers to the computers successfully depending on what OU the computers are in..

But my problem is that there are the old Printer connections from the old print server in the current user in the registry of each PC and everytime the user logs in they get the new printer and also the old printer connection. And it seems to default to the old printer connection instead of the new on, which is not helpful..

Is there anyway I can remove the old printer eg.. \\oldserver\oldprinter ? I have located the printer In the registry and it is under the current user > Printer connections and it looks something like " ,,oldserver,,oldprinter

I have tried so many different scripts and batch files to remove the printers but they just dont seem to be doing the job... Where am I supposed to put a script? In the Computer Startup policy also or in the user startup policy?? It needs to remove the old printer from each current user when they log in. :unsure:

Seems like working with printers on a large network with roaming profiles can be a real headache...


Posted

Here is the beginning of a script I use to replace printers on machines, it deletes all of the installed printers and their associated ports except for the Microsoft Office Document Image Writer and the Adobe blah, blah, blah printer, then deletes the ports. Then I add the desired drivers. This runs as a gpo startup script, it can run as a logon script if the user has admin rights.

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

set objNewPort = objWMIService.get("Win32_TCPIPPrinterPort").SpawnInstance_
Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True
Set objDriver = objWMIService.Get("Win32_PrinterDriver")

set colInstalledPrinters = objWMIService.ExecQuery ("Select * from Win32_Printer")
set objDictionary = CreateObject("Scripting.Dictionary")

'get list of installed printers and delete everything that does not have adobe or microsoft office in the displayed name
for each instPrinter in colInstalledPrinters
if (instr(instPrinter.Name, "Adobe")=0) and (instr(instPrinter.Name, "Microsoft Office")=0) then
instPrinter.Delete_
end if
next

'get new list of installed printers, should only be microsot and adobe add to dictionary for easier search and compare
set colInstalledPrinters = objWMIService.ExecQuery ("Select * from Win32_Printer")

For Each instPrinter in colInstalledPrinters
objDictionary.Add instPrinter.PortName, instPrinter.PortName
Next

'check for installed ports against those listed in dictionary if they don't exist delete them.
Set colPorts = objWMIService.ExecQuery ("Select * from Win32_TCPIPPrinterPort")
For Each objPort in colPorts
If objDictionary.Exists(objPort.Name) Then
'used to do something here but don't anymore just left it for future use.
Else
ObjPort.Delete_
End If
Next

Posted

am I missing something or just being stupid. My apologies if I am just being in id*** ..

I'm using the pushprinterconnection.exe which is put in the GPO Startup of the OU that contains the room computers

Ok so when the user logs in, I go to their printers and faxes folder and its blank for about 10 seconds... and then as if by magic the printers suddenly appear... (INCLUDING THE ONE THAT WAS CONNECTED TO THE OLD SERVER) It is driving me insane.

I have tried putting another script in the GPO startup that deletes the printer. I have even tested the script and it removes the printer but it seems as soon as the spooler is restarted the printer shows its ugly face again!!! I located the rogue printer its in the current user printer connections in the registry..

I even then tried to delete the key on the logon script... the key was deleted successfully... but then seconds later when the spooler starts again and the pushprinterconnection installs the new printer... the OLD SERVER PRINTER REAPPEARS as if by magic!!! I Just can't get rid of the **** thing... I looked in the registry and its added the local user printer connection to the old printer AGAIN!!!

I have checked everything and I'm not running any scripts to install the OLD PRINTER... Its just driving me crazy... I HATE PRINTERS

Thanks

Posted

so how would I use the rundll32.exe against printui.dll

to uninstall an old printer (connected to a server) eg

\\mh-print\RM53-CL

I looked on the link u gave me but I couldn't make sense of the uninstall printer command..

And would I run this command after I have run the pushprinterconnection.exe in the GPO Startup?

thanks

Posted

sounds like you have something else out there publishing the printer to the machine. How was it originally installed on these machines?

Posted

This is how I used to do it.. And this was in the GPO Startup for the computers OU

REM -------------------------------------------------------------------------------------------------------------

rundll32 printui.dll,PrintUIEntry /ga /n \\Room52-1\room52-bl /j"LanMan Print Services"

Net Stop Spooler

Net Start Spooler

REM ----------------------

Posted

Ok well I've figured it out myself after a lot of messing about deleting keys in the registry. These are the locations where I needed to remove the keys to stop the printers keep reappearing when I restarted the spooler.

FOR ANYONE ELSE WHO HAS OR IS EXPERIENCING A SIMILAR ISSUE

-------------------------------------------------------------------------------------

reg delete "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Connections\,,mh-print,rm53-cl" /f

reg delete "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Print\Connections\,,mh-print,rm54-cl" /f

reg delete "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Print\Connections\,,mh-print,rm53-cl" /f

reg delete "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Print\Connections\,,mh-print,rm54-cl" /f

* These go in a batch file that is run on the GPO Startup on the OU containing your computers...

Now when the spooler restarts, these printers don't show up ... Job done

I really feel like going up to the devolpers at microsoft and telling them that they really are overlooking how complicated setting up printers on a network can be. It annoys me a lot..

Anway thanks to all who posted here.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...