remove network printer mappings
im trying to use the following script in the logoff script to remove the network printer mapping from the client PCs.. RUNDLL32 printui.dll,PrintUIEntry /n \\server name /dn But it returns with an error "printer connection cannot be removed.Operation could not be completed (error 0X00000057)..Is there something wrong with the script???? RUNDLL32 printui.dll,PrintUIEntry /n \\server-name\printer-name /dn ..This script works to remove individual printers..but i want to remove multiple printers without specifying the printer names.. Thanks in advance...
March 27th, 2012 11:11am

Hello Try this VBS, It works ======================================= Set WshNetwork = WScript.CreateObject("WScript.Network") Set Printers = WshNetwork.EnumPrinterConnections For i = 0 to Printers.Count - 1 Step 2 If Left(ucase(Printers.Item(i+1)),2) = "\\" Then WScript.Echo Printers.Item(i+1) WSHNetwork.RemovePrinterConnection Printers.Item(i+1) End IF Next ======================================= RegardsEric Malartre
Free Windows Admin Tool Kit Click here and download it now
March 27th, 2012 11:42am

Hi i tried the vbs..it doesnt seem to remove the printer mappings..The printers were mapped using printer management console..and i added the vbs you gave to the logoff script..but doesnt seem to work :(Sumy Sebastian
March 27th, 2012 1:05pm

Hello On my point of view you have a problem in your scenario. because your users quit their offices, logically they are choosing to shutdown their laptop and aren't logging off. So in this case any solutions to remove network printers are failed, because during the shutdown process, Spooler service is stopping. Could you explain why you want to "hide" ("remove") the network printers durin out-of-office period ? is it a "cosmetic" demand to end-user or other aspects ? RegardsEric Malartre
Free Windows Admin Tool Kit Click here and download it now
March 28th, 2012 6:01pm

Hello The user account has has admin privileges and i don't want to use it on logon script as what I want is , once the user logs off and takes his laptop home or is away from the domain ,he shouldn't see the network printers. The OS on client system is windows 7 professional. Regards, Sumy Sebastian
April 7th, 2012 10:50am

Hello On my point of view you have a problem in your scenario. because your users quit their offices, logically they are choosing to shutdown their laptop and aren't logging off. So in this case any solutions to remove network printers are failed, because during the shutdown process, Spooler service is stopping. Could you explain why you want to "hide" ("remove") the network printers durin out-of-office period ? is it a "cosmetic" demand to end-user or other aspects ? RegardsEric Malartre
Free Windows Admin Tool Kit Click here and download it now
April 7th, 2012 11:10am

Hi, Regarding the command line which you mentioned, you may refer to the following article: Rundll32 printui.dll,PrintUIEntry Also, there is a script in the following link for your reference: Contents of Guy's Scripting Ezine No 16a: RUNDLL32 PRINTUI.DLL,PrintUIEntry - Printer Scripts Please Note: Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information. A this issue is related with logoff script, in order to get the answer effectively, it is recommended to post a new question in the Script Forum for further discussion. The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding. Hope this help. Best Regards, Tracy Cai
April 8th, 2012 5:23am

Hello To make sure, Could you try to run this VBS script: as you are connected with the account with needed privilegeduring logon script Please send back details and feedack about he result. What is your OS version on your client workstation ? wich Service pack by OS ? RegardsEric Malartre
Free Windows Admin Tool Kit Click here and download it now
April 8th, 2012 5:48am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics