Link to home
Create AccountLog in
Avatar of mcmoser
mcmoser

asked on

Removing printer from Remote PC

Hello,

Thanks to another user here, i'm now able to get a listing of the printers installed on a remote pc by using:

    Set objLocator = CreateObject("WbemScripting.SWbemLocator")
    Set objWMIService = objLocator.ConnectServer(RemoteComputer, "root\cimv2", RemoteUsername, RemotePassword)
    objWMIService.Security_.impersonationLevel = 3
    Set PrinterList = objWMIService.ExecQuery("Select * from Win32_Printer")
    For Each PrinterInstance In PrinterList
        lstPrinters.AddItem PrinterInstance.Name
    Next
    Set PrinterList = Nothing
    Set WMIService = Nothing


Now I would like to be able to remove a printer from that that workstation. Is it possible? As it is, I can use a dos command to accomplish what I want, but I would like to skip it if possible.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of EDDYKT
EDDYKT
Flag of Canada image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of mcmoser
mcmoser

ASKER

Hi,
I get network connection does not exist when i use that @

Net.RemovePrinterConnection printer


This looks to be a hard thing to do.