Jump to content

Recommended Posts

Posted
We have had some new printers set up on our network, and the old printers have been removed. We use a log on script(batch file) on our Server 2008r2 and in the past I have just added in the REM rundll32 printui.dll,PrintUIEntry /dn /n \\SERVER\printername to the login batch file and it has worked without issue in removing the old print share when staff and pupils log on. This now does not appear to be working to remove the old print share....am I missing something or any idea's? Thanks
Posted

Before we used Group Policy for this, our script was a vbs.

 

' Script to remove existing network printers and add current ones  

' Declare variables and enumerate existing printer connections

On Error Resume Next 

Set WshNetwork = WScript.CreateObject("WScript.Network")
Set Printers = WshNetwork.EnumPrinterConnections

' Delete existing connections to network printers

For i = 0 to Printers.Count - 1 Step 2

   If Left(ucase(Printers.Item(i+1)),2) = "\\" Then
       WSHNetwork.RemovePrinterConnection Printers.Item(i+1)
   End IF

Next

' Add printers and set as default

WshNetwork.AddWindowsPrinterConnection "\\Server\Printer1"
WshNetwork.AddWindowsPrinterConnection "\\Server\Printer2"
WshNetwork.AddWindowsPrinterConnection "\\Server\Printer3"

WshNetwork.SetDefaultPrinter "\\Server\Printer2"

 

There were various versions that different groups got with a different set of printers and default.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...