Loading |
VBScript |
JavaScript |
Powershell |
Search Options: Delete Unused Printer PortsContent of Delete Unused Printer Ports.vbsMD5 Hash: 2F268D4DA1AEB6C101FD3D79746B5B96 |
||
' Description: Deletes any printer ports that have been installed on a computer but are not in use.
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 | ||
© 2008 - 2013 Boris Toll :: Scripts available: 6.481 :: :: scriptbox.toll.at :: :: powered by www.toll.at :: |