Script to Uninstall Printers
Has anyone come across a script that will uninstall all current printers on a user's machine and install new printers that you specify?
0 Comments
[ + ] Show comments
Answers (3)
Please log in to answer
Posted by:
dlernstrom
16 years ago
Currently, we use a login script to install printers that have been shared from a server. One of our servers has about 10 network printers installed on it that are shared. The login script that all users run installs that shared printer.
On my current 'todo' list is to switch that install over to MSI. I ran across a method that allows for printers to be installed via an MSI software install. Once we switch over to that, we can reduce the time that this particular login script takes to execute.
Let me know if something like this is what you are after and how urgently you'd like me to tackle my project.
-David
On my current 'todo' list is to switch that install over to MSI. I ran across a method that allows for printers to be installed via an MSI software install. Once we switch over to that, we can reduce the time that this particular login script takes to execute.
Let me know if something like this is what you are after and how urgently you'd like me to tackle my project.
-David
Posted by:
dlernstrom
16 years ago
I've dug around into my files and found my notes... The idea is to use WIWW to wrap two command line entries, one for install and one for uninstall.
The install would look something like this:
rundll32 printui.dll,PrintUIEntry /if /b "HPLJ4-RIGHTFAX" /f %windir%\inf\ntprint.inf /r "lpt1:" /m "HP LaserJet 4"
The uninstall would look something like this:
rundll32 printui.dll,PrintUIEntry /dl /n "HPLJ4-RIGHTFAX"
I haven't verified the command line parameters. I merely cut and pasted them from a reference I ran across. The potential exists that they are not entirely constructed correctly, so verify all parameters before you attempt it.
The install would look something like this:
rundll32 printui.dll,PrintUIEntry /if /b "HPLJ4-RIGHTFAX" /f %windir%\inf\ntprint.inf /r "lpt1:" /m "HP LaserJet 4"
The uninstall would look something like this:
rundll32 printui.dll,PrintUIEntry /dl /n "HPLJ4-RIGHTFAX"
I haven't verified the command line parameters. I merely cut and pasted them from a reference I ran across. The potential exists that they are not entirely constructed correctly, so verify all parameters before you attempt it.
Posted by:
spartacus
16 years ago
Here's the first step to get you started :
Regards,
Spartacus
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where Network = FALSE")
For Each objPrinter in colInstalledPrinters
objPrinter.Delete_
Next
Regards,
Spartacus
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.