Link to home
Start Free TrialLog in
Avatar of jontyplatt
jontyplattFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Deleting all printers

My client machines have various printerson them most of which are redundant. I need a VB script that will remove all printers when a user logs on.
ASKER CERTIFIED SOLUTION
Avatar of trenes
trenes
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SamuraiCrow
SamuraiCrow

If there are windows xp machines add this line to the login script:

prnmngr.vbs -x

This will delete all printers installed on the machine.  If you just want this to run once you can add the following:

:Start
if exist \\servername\sharename\%username%-%computername%.txt goto End
prnmngr.vbs -x
echo %username%>\\servername\sharename\%username%-%computername%.txt
:End

This will check for a file based on the username and computername (and go to the end of the process if it finds it), remove the printers, create a file based upon the username and computername (to be found the next time the user logs on).

Three words of wisdom:

Test
Test
Test

Hope this helps
Crow
create a bat file with the following lines of code, this is provided that all the printers you want to delete are shared printers. Just keep repeating the line specifying a new printer. place the bat file in the netlogon folder and specify the name of the batch file in the logon script box of the user's profile properties



rundll32 printui.dll,PrintUIEntry /dn /n "\\servername\printersharename"