PHP Code:on error resume next
Dim objNetwork, compName
Set objNetwork = CreateObject("WScript.Network")
compName = lCase(left(objNetwork.ComputerName,3))
if compName = "lap" then compname = lCase(left(objNetwork.ComputerName,7))
Select Case compName
Case "lib"
nukePrinters
objNetwork.AddWindowsPrinterConnection "\\printserver1\Library HP CP2020"
objNetwork.SetDefaultPrinter "\\printserver1\Library HP CP2020"
Case "sp-"
objNetwork.AddWindowsPrinterConnection "\\printserver2\Kyocera TASKalfa 250ci"
objNetwork.SetDefaultPrinter "\\printserver2\Kyocera TASKalfa 250ci"
Case "lap-ent","lap_ent"
nukePrinters
objNetwork.AddWindowsPrinterConnection "\\daisy\e1"
objNetwork.AddWindowsPrinterConnection "\\printserver1\e2-2600"
objNetwork.AddWindowsPrinterConnection "\\printserver1\e3-cp2020"
objNetwork.SetDefaultPrinter "\\printserver1\e3-CP2020"
Case "lap-hum","lap_hum"
nukePrinters
Case "lap-mfl","lap_mfl"
nukePrinters
End Select
function nukePrinters
strComputer = "."
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery("Select * from Win32_Printer")
For Each objPrinter in colInstalledPrinters
if InStr(objPrinter.Name, "\\") > 0 then
WshNetwork.RemovePrinterConnection objPrinter.Name
end if
Next
end function
Sort of related to this topic.
Setting default printers is mentioned here.
Just tried it on my 2003 domain and it works lovely... I just used a 2008 non DC server to do the preferences
Set Default Printer with Windows 2008 Server Group Policy Preferences - Set the Default Printer via Group Policy | Windows Server Administration
Doh,
I put it in to the boot script and it worked fine.
Thanks
Use group policy?
an alternative
rundll32 printui.dll,PrintUIEntry /in /n\\SERVERX\XMono
I deploy printers per user, per computer or a combination of both using 2003 R2 Print Management.
As for setting up the default printer I use a reg file at logon to set the default:
The easiest way is to set a printer as default, then navigate to HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows within the registry and export the entries, then save the reg file within your NETLOGON share and update logon scripts accordingly.Code:Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows] "Device"="\\\\SERVERNAME\\PRINTER-NAME,winspool,Ne03:"
recently ive started deploying with the 2003 r2 method and deploying printers to a policy then assigning that to the appropriate ou or using filtering and applying it to a group then adding a login script running pushprinterconnection to xp pcs. To set the default i use a heavily cut down version of my old vbs script that just sets the dfault printer (sets it once as network printer then tries to set it as local printer and all my local printers are called local printer)
i just copy a shortcut to that vbs scrpit to %allusersprofile%\start menu\programs\startup\printers.lnk and as i always copy it with a name specified if i move it to a new ou it will copy say suite.lnk or ks1.lnk as printers overwriting the old one. On older deployments i just did the vbsCode:' Printers.vbs - Jonathan Option Explicit Dim objNetwork on error resume next Set objNetwork = CreateObject("WScript.Network") objNetwork.SetDefaultPrinter "\\server\Laser1" objNetwork.SetDefaultPrinter "local printer"
objNetwork.SetDefaultPrinter "local printer"
There are currently 1 users browsing this thread. (0 members and 1 guests)