Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: delete local printers mapped
My code is simple (perhaps too simple), it retrieves the name of the local printers, and if the printer port isn't LPT1: then it deletes the printer. Appearantly, the name of a locally installed network printer on Start/settings/printers is different than the returned name of a locally installed network printer. For example: the local name may be "HP8100N on SERVER", but the name returned from the extender was "\\SERVER\HP8100N". And when we ran the code, it deleted "\\SERVER\HP8100N" from our SERVER along with every other network printer on our server.
My question is: How do I delete locally installed network printers without deleting the printers from the server?
An example my used code is below:
AddExtender("WWPRT34i.DLL") printers = pGetPrtList(1) a = ItemCount(printers, @TAB) For j = 1 to a indv_ptrs = ItemExtract(j, printers, @TAB) If ItemExtract(2, indv_ptrs, "|") == "LPT1:" then next pDelPrinter(ItemExtract(1, indv_ptrs, "|")) Next
AddExtender("WWPRT34i.DLL") printers = pGetPrtList(1) a = ItemCount(printers, @TAB) For j = 1 to a indv_ptrs = ItemExtract(j, printers, @TAB) If ItemExtract(2, indv_ptrs, "|") == "LPT1:" then next prtr=ItemExtract(1, indv_ptrs, "|") if WinVersion(4) == 4 && StrIndex(ItemExtract(1, indv_ptrs, "|"),"\",0,@backscan); NT/2000/XP midslashptr=StrIndex(prtr,"\",0,@backscan) srv=strsub(prtr,1,midslashptr-1) p = ItemExtract(2, indv_ptrs, "|") pause(srv,p) pDelPrtConn(srv,p) else pause("",prtr) pDelPrinter(prtr) endif Next
Article ID: W15072
File Created: 2002:09:05:13:49:26
Last Updated: 2002:09:05:13:49:26