Deleting printer using VB

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi
Have the following code to list all printers on chosen remote computerDim strComputer As String
Dim objWMIService, colPrinters, objPrinter As Object
strComputer = tbPCNAME.Text
objWMIService = GetObject("winmgmts:\" & strComputer & "rootcimv2")
colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer")
For Each objPrinter In colPrinters
ListBoxPrinters.Items.Add(objPrinter.DeviceID)
Next
I now need to be able to delete a printer from the remote machine - but cannot see how to do it, a lot of sites mention using objPrinter.Delete but this only seems to work in vb script, not in VB.net
Any ideas please?
Darren Rose

View the full article
 
Back
Top