jontyplatt
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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\%us ername%-%c omputernam e%.txt goto End
prnmngr.vbs -x
echo %username%>\\servername\sh arename\%u sername%-% computerna me%.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
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\%us
prnmngr.vbs -x
echo %username%>\\servername\sh
: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\printershare name"
rundll32 printui.dll,PrintUIEntry /dn /n "\\servername\printershare
http://www.computerperformance.co.uk/Logon/Logon_Remove_Printer.htm