Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete IP Printer & Port via WMI

Status
Not open for further replies.

sn0rg

IS-IT--Management
Aug 5, 2005
95
GB
Anyone know how to do this? I can't see a method to delete printers in WMI, and I have to delete local devices (Attached via Standard TCP/IP port), and then the port.
 

Oddly, I'm unable to make this code work. I get:
object does not support this property or method: 'objPort.delete'

Can anyone tell me why, or offer an alternative way to delete an IP Port?

Sample Microsoft code:
Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colInstalledPorts =  objWMIService.ExecQuery("Select * from Win32_TCPIPPrinterPort Where Name = 'IP_169.254.110.14'")

For Each objPort in colInstalledPorts 
    objPort.Delete
Next
 
objPort.delete_[/color red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top