Remove a printer

In our Microsoft Office 365 v2016 C2R deployment , we have to delete the local “Send To OneNote 2013” printer. This printer was created when we installed Office 2013. After a little bit of searching, I found out 3 ways to delete a printer.

  1. Using command line

You can use the command to remove a printer.

Local printer:
rundll32 printui.dll,PrintUIEntry /dl /n “printer-name” /q

Network printer:
rundll32 printui.dll,PrintUIEntry /dn /n “printer-name” /q

/dl: delete local printer
/n: printer name
/q: quiet

To see all the options, run this command:
rundll32 printui.dll,PrintUIEntry /?

2. Using vbscript

This script scans all local printers on the system then remove the “Fax” printer. Modify the wmi query to get the network or all printers if needed.

strComputer = “.”
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
Set colInstalledPrinters = objWMIService.ExecQuery(“Select * from Win32_Printer where Network = FALSE”)
For Each objPrinter in colInstalledPrinters
 If StrComp(Trim(objPrinter.Name), “Fax”) = 0 Then 
 End If

3. Using PowerShell

This script removes the network printers only. Modify the if statement to remove local or all printers if needed.

$printers = Get-WmiObject -Class win32_printer
foreach ($printer in $printers)
#Remove only network printers
if($printer.Name -ne $null -and $printer.Name.StartsWith(“\\”))


2 thoughts on “Remove a printer

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s