Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Deleting a Printer and Printer port

Featured Replies

What I am trying to accomplish is to delete a printer on a remote machine without having to connect to it. Here is what I have so far:

strComputer = inputbox("Please enter the computer name or IP address.","Computer Name")

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colInstalledPrinters = objWMIService.ExecQuery _

("Select * from Win32_Printer where DeviceID = 'Printer1'")

For Each objPrinter in colInstalledPrinters

objPrinter.Delete_

Next

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colInstalledPorts = objWMIService.ExecQuery _

("Select * from Win32_TCPIPPrinterPort Where Name = 'Printer1'")

For Each objPort in colInstalledPorts

Objport.Delete_

Next

"Printer1" is of course the name of the printer I am removing and this works perfectly but what I would like to do if possible is have it prompt me in a inputbox the name of the printer and whatever is typed in the box goes to where the printer name needs to be in the script. Any assistance would be greatly appreciated. Thank you!

That's a pretty specialized use. Most people would want to ADD a printer.

I printed out your request.......I will see.........

Also, when are you planning on running this script? Before or during the install process? If before, then would be easy to make one like the other settings wizards. You would have to know the names ahead of time.

If during the install process, then no, no prompt box.

  • Author

This is to remove printers already installed. Sometimes we have printers that get hosed up and need to be reinstalled. So technically after.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.