Link to home
Start Free TrialLog in
Avatar of fabien simonetti
fabien simonettiFlag for France

asked on

vbscript and printers : transfer from one server to one another server

Hi,
We have one old server (windows 2003 server) with printers : the name is print01
I install on a new server which the name is "printnew" with share printers.
I defined a vbscript/Active Directory/GPO  in order to install on client (windows xp) the printers from printnew.
I unshared printer on print01.
The problem is that on client, users have always old share printers from print01.

I would like to know if it s possible to remove all printers from print01 are removed thanks to a script.
Thanks,
Regards
Lirlandais
ASKER CERTIFIED SOLUTION
Avatar of Shift-3
Shift-3
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lecaf
lecaf

other script :)
on small advantage I even delete mappings on the made on the IP
but the other script is cleaner :)

m  a  r  c

'on error resume next
'-------------------------------------------------------------------------------
' Object Creation
'-------------------------------------------------------------------------------
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")
'-------------------------------------------------------------------------------
' Main
'-------------------------------------------------------------------------------
DeleteNetPrinters("\\192.168")
DeleteNetPrinters("\\server")
'-------------------------------------------------------------------------------
' Clean up
'-------------------------------------------------------------------------------
Set oPrinters = Nothing
Set WshNetwork = Nothing
wscript.quit(0)

Sub DeleteNetPrinters(ByVAl PrinterServer)
'-------------------------------------------------------------------------------
' Description:  Deletes any Network Printer Present
' Parameters:   begging of printer server url  
'-------------------------------------------------------------------------------
 Set oPrinters = WshNetwork.EnumPrinterConnections
 For i = 1 to oPrinters.Count Step 2
  If Lcase(Left(oPrinters.Item(i),len(PrinterServer))) = PrinterServer Then
   WshNetwork.RemovePrinterConnection oPrinters.Item(i), 1
  End If
 Next
 Set oPrinters = Nothing
End Sub
Avatar of fabien simonetti

ASKER

Thanks a million
thanks you