Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2005-03-12
7
Medium Priority
?
1,407 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
  • 4
4 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

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

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

During and after that shift to cloud, one area that still poses a struggle for many organizations is what to do with their department file shares.
This article is in regards to the Cisco QSFP-4SFP10G-CU1M cables, which are designed to uplink/downlink 40GB ports to 10GB SFP ports. I recently experienced this and found very little configuration documentation on how these are supposed to be confi…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

580 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