You can choose one of following script to use in login script
Script1:
REM the /q makes the command run quietly
REM Remember to replace \machineprinter with the path to your shared printer
REM Quietly install a network printer - per user
REM rundll32 printui.dll,PrintUIEntry /q /in /n "\machineprinter"
REM Quietly delete a named network printer - per user
REM rundll32 printui.dll,PrintUIEntry /q /dn /n "\machineprinte"
REM Set default printer
REM rundll32 printui.dll,PrintUIEntry /y /n "\machineprinter"
REM Quietly install a network printer - per machine
REM rundll32 printui.dll PrintUIEntry /q /ga /n "\machineprinter"
REM Quietly delete a network printer - per machine
REM rundll32 printui.dll PrintUIEntry /q /gd /n "\machineprinter"
REM Quietly delete a specific printer driver
REM rundll32 printui.dll,PrintUIEntry /q /dd /m "PrinterDriver"
Script2:
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'+ Purpose: This code will add a shared network printer
'+to your computer and set
'+ it to be the default printer
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' Variables must be declared
Option Explicit
' Suppress errors
on error resume next
' Declare Variables
Dim objPrinter, printerPath
' Path to printer (Add your information below)
printerPath = "\yourserverprintername"
Set objPrinter = CreateObject("WScript.Network")
' Add printer
objPrinter.AddWindowsPrinterConnection printerPath
' Add as default
objPrinter.SetDefaultPrinter printerPath
wscript.sleep 500
WScript.Quit
Script3:
Set WshNetwork = CreateObject(“WScript.Network”)
PrinterPath = “\serverprintername”
PrinterDriver = “HP LaserJet Whatever”
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver WshNetwork.SetDefaultPrinter “\serverprintername
Note:
(Keep in mind this object is only used for connecting to network printers (or network shares)Save it as a VBS file.open ADUC and create OU.Go to the properties of that OU and click on the group policy tab. Click on NEW in the GP ,Go to user config, windows settings, scripts, and double click on the LOGON. Add created VBS file.Run gpupdate /force on the users box.)