Enumerate and then remove all networked printers
- From: "Jeremy Schubert" <jscc-nospam@xxxxxxxxxxx>
- Date: Fri, 10 Aug 2007 21:14:27 -0600
Does this script look right to enumerate which network printers are attached to a user's profile and then delete them?
(I'll be able to check it out after the weekend when the school opens back up. But I thought I'd also check in here in the meantime).
CODE
---------
On error resume next
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oDrives = WshNetwork.EnumNetworkDrives
Set oPrinters = WshNetwork.EnumPrinterConnections
For i = 0 to oDrives.Count - 1 Step 2
WshNetwork.RemoveNetworkDrive oDrives.Item(i),true,true
Next
For i = 0 to oPrinters.Count - 1 Step 2
WshNetwork.RemovePrinterConnection oPrinters.Item(i+1)
Next
.
- Follow-Ups:
- Re: Enumerate and then remove all networked printers
- From: ThatsIT.net.au
- Re: Enumerate and then remove all networked printers
- Prev by Date: Re: Custom IE toolbar button
- Next by Date: Find and copy files with a certain extension to a directory
- Previous by thread: Re: Name of .INF for WMI Windows Install Provider
- Next by thread: Re: Enumerate and then remove all networked printers
- Index(es):