Need to remove network printers but not mapped printers



I am renaming my network printers and have tested this script and it removes
all network printers and leaves local printers alone:

ON ERROR RESUME NEXT
Dim WSHShell, WSHNetwork, objDomain, DomainString, UserString, UserObj, Path
Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
Set WSHPrinters = WSHNetwork.EnumPrinterConnections
For LOOP_COUNTER = 0 To WSHPrinters.Count - 1 Step 2
If Left(WSHPrinters.Item(LOOP_COUNTER +1),2) = "\\" Then
WSHNetwork.RemovePrinterConnection WSHPrinters.Item(LOOP_COUNTER
+1),True,True
End If
Next
set UserObj = Nothing
set GroupObj = Nothing
set WSHNetwork = Nothing
set DomainString = Nothing
set WSHSHell = Nothing
Set WSHPrinters = Nothing
wscript.quit

Then I use this script to map a renamed printer such as CA - HP LaserJet
4050 PS near Purchasing on the \\printerserver:

Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection "\\printserver\CA - HP LaserJet 4050
PS near Purchasing"

The problem is the top script also removes mapped printers that are shared
between desktop PCs. How can I change the top script to remove only network
printers that are attached to \\printserver and not to \\desktopPC ?

Thanks for any help.

Larry


.



Relevant Pages

  • Re: Domain Logon Script Advice
    ... users printers and network shares based upon which Active Directory OU ... I happy with deploying the script via GPO etc, ... A very basic VBScript logon script to map the same printer and shares to all ...
    (microsoft.public.scripting.wsh)
  • Re: Adding Missing printer if they not there
    ... I edited the script but it keeps erroring on line 38, ... Const T = 1 ... 'DIM Printerwould be for 5 printers. ... checked only the network printers against our list to see if any of our ...
    (microsoft.public.windows.server.scripting)
  • Re: Re: Running an OU policy only after a previous OU policy com
    ... > Printers with .vbs logon scripts because regular users don't ... In the Computer Configuration ... > Script and in the User Configuration I put the Same as a Logon ...
    (microsoft.public.win2000.group_policy)
  • Printer question
    ... This question is not as much the content within a script, ... What is the best way to assign default printers with the following conditions. ... Thin clients using Citrix. ... OU and assigning a GPO to the container, however Thin clients are not in ADS. ...
    (microsoft.public.scripting.vbscript)
  • Removing Network Printers - Two Quick Questions Please
    ... when I remove a printer via the logon script it works - the first time - just fine. ... possible to remove all printers that are homed on one server? ... objNet.AddWindowsPrinterConnection strPrinter1 ...
    (microsoft.public.scripting.vbscript)

Loading