GTwannabe 0 Posted September 15, 2004 I'm trying to write a script to automatically add a printer to client XP machines. This script works: rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /f \\XXX.XX.XXX.XX\download\4600driver\hp4600p6.inf /r "lpt1:" /m "HP Color LaserJet 4600 PCL 6" /Z But I want to change the port from "lpt1:" to an IP address. Anyone know the syntax to do this? I've tried "IP_XXX.XX.XXX.XX", but I get a "the arguments are invalid" error after Windows starts copying files and the printer does not show up in the printers folder. Share this post Link to post
twinsen456 0 Posted November 10, 2004 Have you found the solution yet? I'm having the _EXACT_ same problem here.. I wish I could void using scripts by adding group policies, but the headoffice won't give us enough rights to do so... I found some info on this werbsite: http://support.microsoft.com/default.aspx?scid=kb;en-us;189105 Interesting, but did not solve anything... Share this post Link to post
GTwannabe 0 Posted November 10, 2004 Yes and no... I fought with this for a long time, but I got it to work. I bundled all the scripts into an EXE that can be placed in a user's Run at First/Next Logon or installed manually. This script will map a shared printer to a virtual network port: ********************************************************** @echo off NET USE LPT3: /DELETE NET USE LPT3: "\\XXX.XX.XXX.XX\PSB Color Laser Printer" PrintOnlysPassword /user:YourDomain.local\printonly /PERSISTENT:YES MKDIR "C:\documents and settings\all users\start menu\Programs\Startup" COPY mapLPT3.bat "C:\documents and settings\all users\start menu\Programs\Startup" rundll32 printui.dll,PrintUIEntry /if /b "IES Color Laser Printer" /f \\XXX.XX.XXX.X\download\4600driver\hp4600p6.inf /r "lpt3:" /m "HP Color LaserJet 4600 PCL 6" /Z *********************************************************** Then the mapLPT3.bat file that restores the printer port mapping on reboot: ****************************************************** @ECHO OFF NET USE LPT3: /DELETE NET USE LPT3: "\\XXX.XX.XXX.X\PSB Color Laser Printer" PrintOnlysPassword /user:YourDomain.local\printonly /PERSISTENT:YES ****************************************************** I had to map to a share instead of an IP port, because Windows will not let you map an IP port that does not already exist on the system. Since you have to map to a share, you need to use a valid domain account to authenticate against the share. It has some problems though: 1. Unsecured domain account and pwd floating around - anyone who digs out the userID and pwd from the files will be able to log in as a user at any workstation on the domain. I packaged the files into self-extracting .EXE's so that it won't be obvious to most users. I tried for weeks to set Active Directory so that it will "Deny Interactive Logon" for the printonly account/security group/OU, but it had no effect no matter what I did. 2. Only works with English installs of Windows. 3. Not backwards compatible with 98 clients. Don't know if this will help, but it might give you some ideas. Share this post Link to post
twinsen456 0 Posted November 12, 2004 All great, but I really want to add a printer with its IP-address, to unload an old server. I'll try to get permission to use group policies instead or something.. Tnx anyway! Share this post Link to post
GTwannabe 0 Posted November 12, 2004 There is a reason for the IP address in the path to the printer (at least for my organization) My script was written mostly for visiting scientists who use the network, but do not log onto the domain. As such, sometimes non-domain Windows clients get pissy about resolving the server's name (05ies) Mapping to the IP address\share just makes things easier in that respect. Share this post Link to post