Re: Need to remove network printers but not mapped printers



I thought that might be a solution but nothing happens when I tried that. I
found that I can remove the old printers specifically by name and since
there are no more than 3 or 4 in any given department I can do it that way.
Still, if someone knows a solution I would prefer a global remove for
printers coming from the printer server.

Thanks for the suggestion,

Larry


"Andrew Cushen" <noone@xxxxxxxxxxxxxxxx> wrote in message
news:boqef.10377$ek6.9256@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Larry:
>
> Can't you just replace this one line:
>
> If Left(WSHPrinters.Item(LOOP_COUNTER +1),2) = "\\" Then
>
> With this:
>
> If Left(WSHPrinters.Item(LOOP_COUNTER +1),2) = \\printserver Then
>
> ?? That should work.
>
> If "printserver" is not the actual name of the server, you'll need to
> change it.
>
>
> --
> -Andrew Cushen
> ===============================================================
>
> "Larry D" <larryd@xxxxxxxxxxxxxxxxxxxx> wrote in message
> news:eLp8LnW6FHA.3636@xxxxxxxxxxxxxxxxxxxxxxx
>>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)
  • Need to remove network printers but not mapped printers
    ... I am renaming my network printers and have tested this script and it removes ... Set WSHNetwork = CreateObject ... Then I use this script to map a renamed printer such as CA - HP LaserJet ...
    (microsoft.public.scripting.wsh)