?
Solved

Add Port, Delete Port and Assign Port to printer ( script  please)

Posted on 2005-03-12
7
Medium Priority
?
1,393 Views
Last Modified: 2008-03-10
I need to achieve the following A.S.A.P

I need a script for the following:

Add 60 TCP/IP printer port  
Assign in the new TCP/IP Ports to 60 printers
Delete 60 TCP/IP printer port  

This is a windows 2000 environment.

Thanks.
0
Comment
Question by:kellyexch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
7 Comments
 
LVL 5

Expert Comment

by:rikke_vp
ID: 13523560
Actually I'm not getting your question since it contains no specifications about your setup.. But you are talking bout a adding a TCP/IP port, well.. This is always done on the printserver because you want to share a network printer offcourse on its IP.. But, since its installed on the printserver we share it on that last one..

Install printer on printserver on IP_192.168.1.10 port
Share the printer on the server

The thing I would try next is
make a batch for logon

@echo off
net use lpt1: /delete (delete the device on Local Print Port if exists)
net use lpt1: \\printserver\printer /persistent: YES (add printer and keep this printer persistent)

make a batch for logoff

@echo off
net use lpt1: /delete (delete the printer since workstation can be used by a next user that is not allowed to print on network printer)

put this logon script in your netlogon share of the Y2K AD environment. After that open the OU (Organisational Unit) from all your users (top level OU). Open your GPO that is in here or add a GPO.

In your GPO table so to user configuration -> windows environment -> logon/logoff..
Add the logon.bat in the logon section.
Add the logoff.bat in the logoff section.

This should be enough to work.

Keep me posted
Rikke
0
 
LVL 5

Expert Comment

by:rikke_vp
ID: 13523571
What I also want to say.. LPT ports are best used when working with some older programs and sertenly on OLD DOS programs since most of them do not know other print ports..

You also can use this script(VBS) but its long, hard to read and the BAT script posted above do the same thing:

Map a network printer by using the Windows Scripting Host (WSH) to run a Visual Basic script:

Set WshNetwork = CreateObject("WScript.Network")
PrinterPath = "\\YourServer\YourPrinterShare"
PrinterDriver = "YourPrinterDriver"
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
WshNetwork.SetDefaultPrinter "\\YourServer\YourPrinterShare"

NOTE: YourPrinterDriver must exactly match the driver name in the Ntprint.inf file.

If you wish to add a different printer for each user who logs on to Terminal Services:

Set WshNetwork = CreateObject("WScript.Network")

Select Case WshNetWork.UserName

    Case "Username1"

        PrinterPath = "\\YourServer\YourPrinterShare1"
        PrinterDriver = "YourPrinterDriver1"
        WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
        WshNetwork.SetDefaultPrinter "\\YourServer\YourPrinterShare1"
   
    Case "Username2"

        PrinterPath = "\\YourServer\YourPrinterShare2"
        PrinterDriver = "YourPrinterDriver2"
        WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
        WshNetwork.SetDefaultPrinter "\\YourServer\YourPrinterShare2"
   
End Select
Using a logon script or Group Policy, run the script each time a user logs on to the client
0
 
LVL 5

Accepted Solution

by:
rikke_vp earned 2000 total points
ID: 13845265
This also works in a simple batch file..

rem Install the printer
rundll32 printui.dll,PrintUIEntry /in /n "\\yourserver\printshare"

rem Set printer to default printer
rundll32 printui.dll,PrintUIEntry /y /n "\\yourserver\printshare"

Greets and please reply or let me know that your problem is fixed :)
Rikke
0
 
LVL 5

Expert Comment

by:rikke_vp
ID: 14005611
TheLearnedOne ,
I have a comment :)

What about the points? I did try to help and I'm sure that the solutions posted in here are adequate for solving the questioners problem.

Regards,
Rikke
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question