Link to home
Start Free TrialLog in
Avatar of Trihimbulus
Trihimbulus

asked on

VB Script to remove local printer and network printer

I need a script that will delete two printers on each workstation. One of the printers is a local printer named PIK 7000. With this, I also need it's associated custom port deleted which is named PIK 0. Also, I need all associated drivers removed. These drivers are primarily located in the below locations:

del /F /Q C:\Windows\System32\Spool\Drivers\W32x86\ka*.*
del /F /Q C:\Windows\System32\Spool\Drivers\W32x86\ki*.*
del /F /Q C:\Windows\System32\Spool\Drivers\W32x86\ku*.*
del /F /Q C:\Windows\System32\Spool\Drivers\W32x86\2\ka*.*
del /F /Q C:\Windows\System32\Spool\Drivers\W32x86\2\ki*.*
del /F /Q C:\Windows\System32\Spool\Drivers\W32x86\2\ku*.*
del /F /Q C:\Windows\System32\Spool\Drivers\W32x86\2\temp\ka*.*
del /F /Q C:\Windows\System32\Spool\Drivers\W32x86\2\temp\ki*.*
del /F /Q C:\Windows\System32\Spool\Drivers\W32x86\2\temp\ku*.*
del /F /Q C:\Windows\System32\Spool\Drivers\W32x86\3\ka*.*
del /F /Q C:\Windows\System32\Spool\Drivers\W32x86\3\ki*.*
del /F /Q C:\Windows\System32\Spool\Drivers\W32x86\3\ku*.*
del /F /Q C:\Windows\System32\Spool\Drivers\W32x86\3\temp\ka*.*
del /F /Q C:\Windows\System32\Spool\Drivers\W32x86\3\temp\ki*.*
del /F /Q C:\Windows\System32\Spool\Drivers\W32x86\3\temp\ku*.*
del /F /Q C:\Windows\System32\kaw2kppm.dll
del /F /Q C:\Windows\System32\kuwxppm.dll

** One side note - after deleting the files above, the driver still show up in Printers and Faxes > Server Properties > Drivers.

The other printer I need to be deleted from each workstation (in the same script) is named Plotter PIK 7000. This is a network printer and the UNC path is \\printserver\Plotter PIK 7000.

*** Side note - is there a way to target any associated drivers to be deleted?

Lastly I need the following registry key to be deleted from each workstation in this same script:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\PIKMonitor]

Let the battle Begin :)
ASKER CERTIFIED SOLUTION
Avatar of solomonacquah
solomonacquah
Flag of United States of America 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