Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assign Printers to OUs

Status
Not open for further replies.

caymanjohn

Instructor
Jan 20, 2003
5
US
I noted a thread about applying scripts to set printers in AD

I am in a school with 2k in a number of rooms, each with 3 printers. This is the script I use for 1 OU (a part of ROOM21 OU)

'Vb script to add printers via login script
Set WshNetwork = WSCRIPT.CreateObject("WScript.Network")
PrinterPath = "\\svrjg01\RM21A"
'PrinterDriver = "HP LaserJet 2100 Series PCL 6"
WshNetwork.AddWindowsPrinterConnection PrinterPath
PrinterPath = "\\svrjg01\RM21Colour"
'PrinterDriver = "HP 2500C Series"
WshNetwork.AddWindowsPrinterConnection PrinterPath
PrinterPath = "\\svrjg01\RM21B"
'PrinterDriver = "HP LaserJet 5P"
WshNetwork.AddWindowsPrinterConnection PrinterPath
WshNetwork.SetDefaultPrinter PrinterPath

It is applied to COMPUTER CONFIGURATION - WINDOWS SETTINGS - STARTUP SCRIPT

When a machine boots up, it runs the script, but shows an error

\\jghs,edu.ky\sysvol\jghs.edu.ky\policies\{5EE1AC4F-8DED-4546-A729-EF71EBB63596}\Machine\Scripts\Startup\Printers.vbs
Line 5
Char 1
Error System cannot find the file specified
Code 80070002
Source (Null)

Any ideas what I'm soing wrong??

Thanks

John
 
Hello John,
Does the script work when you run it after the machine has started up?

If it does work then does the user have to be authenticated before you can attempt to connect to domain/workgroup resources?

I have never attempted to map printers from a computer startup script so i am only guessing.

Regards,
Richard
 
Thanks for your reply.
Yes - the script runs fine if I browse, find it and run it!
OF course, this is only after a user has logged on - the error appears during the "Running Startup Scripts" dialogue box when a machine starts up. Are you thinking that the user, not the machine, needs the script? I hoped I would only have to apply it once - which seems a logical way to do it?

I wondered if the script needs to be saved in a root folder, rather than just appear in AD?

John


 
hmmm, if you have access to AD then try and run it as a user script and see if that errors.

seeing as you are getting a specific error back from AD saying that there is an error in line 5 of your vbs file then i would say the machine/ad can find the script and execute it.
line 5 is the call to actually add the printer.

let me see how we do it. we use a batch file with the following lines in it

rundll32 printui.dll,PrintUIEntry /in /n

i would have thought one could install a print to be available to "All Users" sort of installing to the all users profile i guess then you would only have to run it once.

i am not sure where we call our batch file, ie if it is part of a user install process or machine specific.

let me ask my work chums in the morning, it is 10pm here i need to get a life and go home

regards and happy hunting
Richard
 
Thanks again - the user script also errors.

In any case, we don't care who logs on at the machine - if it's the corner of room 21, we want their default to be PRINTER21A, with 2 other room 21 printers available.

Could the file not found error refer to the actual printer name (which is specified in line 5)?

John
 
Set WshNetwork = CreateObject("WScript.Network")
PrinterPath = "\\printserv\DefaultPrinter"
PrinterDriver = "Lexmark Optra S 1650"
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver

if i run the above on my machine i get error messade

"the printer name is invalid"

so i would say its no cause you cant find the printer.

the above mentions the printer driver and that this only need to be used with win9x. i am not too familar with the mapping of printers but could it be that the machine you are running the script on doesnt have the right driver for the printer you are trying to install??? or does the print server have the driver files published as part of the print q setup? try and install the type of printer manually to the target machine to make sure the drivers are installed. uninstall the printer but leave the driver files in place, then re-run your script locally to see if it was a driver issue.

rich
 
Thanks again for your interest - I used both the printerdriver script and the non printerdriverscript - both with the same results (we are purely Win2K).

The machines already have these printer drivers, and have printed to them in the past. Problem is, when a user logs on, the old batch file that we used, with CON2PRT, doesn't always assign the correct printer (if any at all!!) to the user. That's why we want to use AD.

We'll keep looking!

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top