hey ppl, I want to map two printers to one of our labs using .vbs and GPO. the print server is located at same location. I want to apply it to the 'computer' so who ever logs on has access to those printers. Here is an example of the .vbs I'm using...
******************************************
Option Explicit
Dim objNetwork, strUNCPrinter1, strUNCPrinter2
strUNCPrinter1 = "\\zara\HPLaserJ"
strUNCPrinter2 = "\\zara\Epson"
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection strUNCPrinter1
objNetwork.AddWindowsPrinterConnection strUNCPrinter2
objNetwork.SetDefaultPrinter strUNCPrinter1
WScript.Quit
******************************************
when I run this script locally it works fine. When I add it to the OU policy's 'Startup' it does not workAlso, should I be using a .bat instead? any help is appreciated.
-j

I'd think you'd want this as a login script rather than a start up script.
If you have Server 2003 R2, you can leverage that to deploy it.
You could use printui.dll I think to add a printer per machine
http://download.microsoft.com/downlo...UsersGuide.doc [ Windows Server 2003: PrintUI.DLL User's Guide and Reference ]
i use a startup script to copy a shortcut to the printer script to the %allusersprofile%\start menu\programs\startup that way every time anyone logs into that pc it runs the latest version of the vbs form the server

You can deploy by user or by machine using GPOs, or a combination of both![]()
You have to set the loopback processing as well.
Open the Group Policy Object editor (gpedit.msc) and go to the group policy you set for the script you are using.
Expand the Computer Configuration node.
Expand the Administrative Templates node.
Expand the System node.
Expand the Group Policy
Locate the setting "User Group Policy loopback processing mode".
Double click this setting.
Set it to "Merge"
Your Group Policy should now work
If it still doesn't work, try putting your script in the "Logon" part of the OU instead of the "Startup"
thanks for all the replies. the mapping still does not workI've done a 'gpresult' on the workstation and it shows it's pulling from the correct GPO. I've done a gpupdate and reboot the workstation but the printers are not showing up in 'Printers and Faxes'. I've tried puting the .vbs in the 'Logon' and the 'Startup' with no success. But again if I run the same script locally the printers show up
Anyway, if anyone has any ideas I'd appreciate it.
I use a similiar setup / script.
The script is added to the GPO that is assigned to the OU that the computer is contained within.
User Configuration > Windows Settings > Scripts (Logon/Logoff)
As mentioned, make sure that "Local Loopback" is enabled and set to "Merge"
Also check the properties of the GPO to ensure that "Disable User Configuration Settings" is NOT enabled.
Failing that check the permissions of the printer, and possibly check restrictions of other GPOs that are applied to users / students. May find that "run command" is disabled that would stop .bat files unless the option is enabled to allow this during logon.
script still not workingLoopback is enabled and set to 'Merge' and I tried putting the script in both
"Logon" and "Startup" part of the OU. Printer permissions are set to Everyone/Full and I even threw the
user group in. I also added that user group into the local Administrator group of each workstation but still
nothing. What am I missing? should I do away with the .vbs and try .bat?
Here's a sample vbs of a script I use:
It's saved to the "netlogon" folder.Code:Set wshNetwork = CreateObject("WScript.Network") on Error Resume Next Printer1="\\printserver\printer_name" 'Deletes all network printers Set clPrinters = WshNetwork.EnumPrinterConnections On Error Resume Next For i = 0 to clPrinters.Count - 1 Step 2 wshNetwork.RemovePrinterConnection clPrinters.Item(i+1), true Next 'Sets up printers WshNetwork.AddWindowsPrinterConnection Printer1 WshNetwork.SetDefaultPrinter Printer1
In the GPO it's added into "Administrative Templates->System->Logon->Run these programs at user logon".
If your script isn't working, try manually running it after logging-in. Here we have a problem in that we have to log-in as an admin if the printer driver hasn't been installed yet.

@techi211: Also check out http://www.edugeek.net/wiki/index.ph...ed_on_Location
I use an environment variable to set the location of each computer, i apply that using policy make to add the reg entry for the environment variable to each OU in which i put the computers in each location. you can add an environment variable at HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment. i call mine location and then give each location a number.
then in my logon scripts i poll for the location number using an IF statement like this:
if env("location") = "1" then
objNetwork.AddWindowsPrinterConnection "\\server\printer1"
objNetwork.SetDefaultPrinter "\\server\printer1"
objNetwork.AddWindowsPrinterConnection "\\server\printer2"
elseif env("location") = "2" then ...
and so on.
id say thats a pretty easy and fool proof way to do it.
anyways im new to this forum but i hope that helps in some small way.![]()
Slightly off topic, but you might want to check this script I found a while back (author in script comments). It allows printer allocation based off the beginning of the computer name. So if you have 6A-01, 6A-02, etc where 6A is the room name then all computers in that room get the printers specified
Code:' Script to add network printers to workstations and thin clients ' Author: Ric Charlton ' Declare variables and enumerate existing printer connections On Error Resume Next Set WshShell = WScript.CreateObject("WScript.Shell") Set WshNetwork = WScript.CreateObject("WScript.Network") Set oPrinters = WshNetwork.EnumPrinterConnections Dim computerName computerName = LCase(WshNetwork.ComputerName) ' Delete existing connections to network printers For i = 0 to oPrinters.Count - 1 Step 2 On Error Resume Next if Left(oPrinters.Item(i), 2) = "\\" then WshNetwork.RemovePrinterConnection oPrinters.Item(i+1), true, true end if Next ' Not used by me, but I left in here incase for others ' Change "svrts" to the name of name thin client server so that the script uses the thin client name ' instead of the server's ' Citrix specific section if (Left(computerName, 5) = "svrts") then computerName = LCase(WshShell.ExpandEnvironmentStrings("%CLIENTNAME%")) end if ' Add printer connections dependant upon location ' Variable to select print server Dim printServer printServer = "theta" ' These mount for all machines WshNetwork.AddWindowsPrinterConnection "\\" & printServer & "\PrinterA3" WshNetwork.AddWindowsPrinterConnection "\\" & printServer & "\Printer8" Select Case (Left(computerName, 3)) Case "6a-" WshNetwork.AddWindowsPrinterConnection "\\" & printServer & "\Printer5" WshNetwork.AddWindowsPrinterConnection "\\" & printServer & "\Printer7" WshNetwork.SetDefaultPrinter "\\" & printServer & "\Printer5" Case "06-" WshNetwork.AddWindowsPrinterConnection "\\" & printServer & "\Printer3" WshNetwork.AddWindowsPrinterConnection "\\" & printServer & "\Printer4" WshNetwork.SetDefaultPrinter "\\" & printServer & "\Printer3" Case "lib" WshNetwork.AddWindowsPrinterConnection "\\" & printServer & "\Printer1" WshNetwork.AddWindowsPrinterConnection "\\" & printServer & "\Printer2" WshNetwork.AddWindowsPrinterConnection "\\" & printServer & "\Printer3" WshNetwork.SetDefaultPrinter "\\" & printServer & "\Printer1" End Select ' This lets you pick of specific full computer names where they don't fit into the scheme above Select Case (computerName) Case "np000e7bd5a561" WshNetwork.AddWindowsPrinterConnection "\\" & printServer & "\\Printer1" WshNetwork.AddWindowsPrinterConnection "\\" & printServer & "\\Printer2" WshNetwork.SetDefaultPrinter "\\" & printServer & "\\Printer3" End Select
thanks all, the scripts I have and the scripts that were posted here all work if I run them locally. My problem is the workstations are not pulling down scripts. I've checked permissions on the printers, I've tried different types of scripts .vbs, .bat, which all work if run locally btw. I have 'Loopback processing mode' enabled. I've tried adding the scripts in the 'Startup' and 'Logon'. I've tried what 'Gerry' suggested.
what I've done for now since I have folder redirect is I created a 'printer' folder in the labs Start/Programs and added the printer's shortcut in that folder. Once the user logs on they double click the printer and it installs it into the 'Printers and Faxes'. I would still like to know why a simple task like mapping printers seems so complicated![]()
There are currently 2 users browsing this thread. (1 members and 1 guests)