WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Printing Information

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Map Printer


Question:

I am upgrading servers from NT to 2003 using an automated process that copies the data to a backup drive then switch the drives to the ones that have 2003 on them and then copies the data back to the 2003 server. Here is my problem with this. The server names are changing and the printer queues are also changing which will force the users to re-map their printers. The logon script will handle their drives but not the printers. For now there are NT systems and XP systems since they have not all been upgraded yet. I am looking for a way, the best way to some how check the users printers they have mapped and then re-map them for them without the user needing to do anything. I am looking for some ideas on how to handle this problem. I know that WB is a great tool and should be able to do it. Thanks for the help!

Answer:

The Printer extender and some registry examination should tell you what you need to know. The Printer extender should be able to change an existing printer's actual network resource to point to the new server\printer share on your upgraded servers. If not, then you can hack it directly in the registry and reboot the workstation or stop & restart the print spooler service to make the changes take effect.

You will first you have to delete the printer, then pPrtAddConn to add it back in.

AddExtender("WWPRT34i.DLL")
GetPrinterList = pGetPrtList(0)
b=pGetDefPrtInf(1)
message('',b)

:Building1
;Our last script had 98 entries like the one below..
Printer1=StrIndexWild(GetPrinterList,'OLD PRINTER NAME','1')
If Printer1 != 0 
pDelPrtConn('\\OLDSERVER','PRINT QUEUE')
pAddPrtConn('\\NEWSERVER','PRINT QUEUE')
EndIf

User Reply:

Here is my final script thanks for all the help.
AddExtender("WWPRT44i.DLL")


Plist=pGetPrtList(0)
Pcount=ItemCount(Plist,@tab)

for a=1 to Pcount
PrinterX=ItemExtract(a,Plist,@tab)


origdir = DirScript()
printers=inireadpvt("Printers", "%PrinterX%", "0", "%origdir%\printernames.ini")
if printers==0 then goto NoChange
compareprinters = StriCmp(PrinterX, printers)
if compareprinters==0
message("No Change Needed","Did not change printer") ;Used temporally to display actions taken, add ';' in front to remark out.
else
Message("Making Printer Change","Changing Printer from %PrinterX% to %Printers%") ;Used temporally to display actions taken, add ';' in front to remark out.

prxfix=StrClean(printerx, "\", " ", @false, 1)
prxfix2=StrTrim (prxfix)
prxfix3=StrClean(prxfix2, " ", '"', @false, 1)
ServerNamex=Itemextract(1,prxfix3,'"')
Sharex=Itemextract(2,prxfix3,'"')

prfix=StrClean(printers, "\", " ", @false, 1)
prfix2=StrTrim (prfix)
prfix3=StrClean(prfix2, " ", '"', @false, 1)
ServerName=Itemextract(1,prfix3,'"')
Share=Itemextract(2,prfix3,'"')

;pDelPrtConn("\\%ServerName%", sharex) Remove ';' to make active. Used to Delete Printers
;pAddPrtConn("\\%ServerName%", share) Remove ';' to make active. Used to Add New Printers
Endif
:NoChange
Next

Article ID:   W16662
File Created: 2005:02:18:12:21:48
Last Updated: 2005:02:18:12:21:48