Printing Printer Ports and Printer Drivers Delete Unused Printer Ports , WMI
' Delete Unused Printer Ports
Set objDictionary = CreateObject("Scripting.Dictionary")
strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colPrinters = objWMIService.ExecQuery _ ("Select * from Win32_Printer")
For Each objPrinter in colPrinters objDictionary.Add objPrinter.PortName, objPrinter.PortName Next
Set colPorts = objWMIService.ExecQuery _ ("Select * from Win32_TCPIPPrinterPort") For Each objPort in colPorts If objDictionary.Exists(objPort.Name) Then Else ObjPort.Delete_ End If Next
|
VbsEdit includes all these samples!
Download Now!
Version 5.4.1 - This package includes VbsEdit 32-bit, VbsEdit 64-bit, HtaEdit 32-bit and HtaEdit 64-bit. The evaluation version never expires.
Home
Buy Now
HtaEdit
Support
Video
What's new ?
|