You are not logged in.
Pages: 1
I don't know how to add items to an array.
This code is working code, however I want to shorten it and make it more dynamic. Eg I just want to scan once using a WMI query to build an array and then add items to that array then perform the function on that array.
Thanks!
EDIT:
Have since found how to do this, was a just a matter of googling a bit more. Fixed code below
REMOVE_STUPID_PRINTERS.vbs
' version 0.2.1
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Dim strPrinters(4)
strPrinters(0) = "Microsoft XPS Document Writer"
strPrinters(1) = "Microsoft Office Document Image Writer"
strPrinters(2) = "Fax"
strPrinters(3) = "Send To OneNote 2007"
strPrinters(4) = "Send To OneNote 2010"
For i = LBound(strPrinters) To UBound(strPrinters)
'MsgBox strPrinters(i)
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where DeviceID ='" & strPrinters(i) & "'")
For Each objPrinter in colInstalledPrinters
objPrinter.Delete_
Next
Next
Last edited by NDog (30 May 2012 12:53)
cmd, vbs, ps, bash
autoit, python, swift
Offline
You should be able to repurpose the script here for this
http://ss64.com/vb/syntax-qchange.html
To delete without replacing a new printer connection, just strip out the parts that add the new printer mapping.
Offline
Pages: 1