Link to home
Start Free TrialLog in
Avatar of kellyexch
kellyexch

asked on

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

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.
Avatar of rikke_vp
rikke_vp
Flag of Belgium image

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
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
ASKER CERTIFIED SOLUTION
Avatar of rikke_vp
rikke_vp
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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