Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can I map LPT1 to the Client's local printer in the Windows2000 terminal server session

3 views
Skip to first unread message

Steven E. Adams

unread,
Feb 22, 2001, 5:36:50 PM2/22/01
to
Hello all,

I need for my clients to be able to print from thier DOS applications to
LPT1 or LPT2 on thier local machine when they remotely connect to the
company's Windows2000 Terminal Server from outside the network (Internet).

I want to know if there is an easy way to script this instead of having
toVPN into the network?

Example: VPN (I don't want to do it this way if there is an easier way)
1) VPN into the server with your local printer shared.
2) Have the administrator add the printer port to the server
\\workststion\printer
3) When the client runs the DOS application use a batch script: "NET USE
LPT1 \\workstation\printer" to map the printer before the application is
run.


It would be more convienent to just use the TermServ Client only to do all
this. Add too many steps for clents to use the system, and the headaches
begin...

Thanks (In advance)
Steven E. Adams

Dan

unread,
Mar 6, 2001, 1:31:59 AM3/6/01
to
I only had to run the NET USE command once, and that particular user gets
their printer every time they login. I think the switch I used was
/PERSISTENT. Yes, this is printing from a DOS program. I tried it with
another user, same command but different printer. They got their own printer
next time they logged on.

Dan Rollins

"Steven E. Adams" <sad...@home2office.com> wrote in message
news:O5nUgBSnAHA.320@tkmsftngp05...

Chris

unread,
Mar 7, 2001, 9:57:50 PM3/7/01
to
Does that also apply to print servers as well? (printing to a server que)
"Dan" <dband...@qwest.net> wrote in message
news:OQXmtcgpAHA.1472@tkmsftngp03...

Steven E. Adams

unread,
Mar 8, 2001, 7:57:25 PM3/8/01
to
Hello Dan,

When you used the "NET USE LPT1" you were on a local LAN ...weren't you?
This does not apply in my situation.
EXAMPLE:
In order for you to map a printer (NET USE LPT1) to a UNC path
name(\\workstation\printername), the computer has to be apart of the
network.

When I am at home on COX cable, DSL, RoadRunner, or dial-up, the IP address
is sometimes dynamic (DHCP), and when I connect into a terminal server at
work via IP address, my computer does not show up in network neiborhood (UNC
path) because it is not authenticated and translated with (WINS).

I don't want the configuration nightnare of going out to everyone's home to
have everyone authenticate just to get the computer UNC to show up on the
network.

My goal is to have Terminal Server session able to map LPT1 to the remote
computer automatically (Script).

Thanks
Steve

"Dan" <dband...@qwest.net> wrote in message
news:OQXmtcgpAHA.1472@tkmsftngp03...

TP

unread,
Mar 13, 2001, 11:40:12 AM3/13/01
to Steven E. Adams
This is what I did:

When a user logs on--

1. A program runs which gets the default auto created printer and
passes this information on to another program running with print
operator permissions.

2. The other program shares the printer with a hidden share name.

3. The first program performs a net use lpt1
\\server\hiddenprinter$

I plan to improve the program some more, but for now it solves my
problem.

In my case the client has a windows based accounting software
that prints receipts directly to LPTx from the point of sale
module. Accounting reports, etc., use standard windows printers.

It would be nice if I could set default permissions for auto
created printers. I might have missed something, but it seems
that the default permissions are hard coded. I have a separate
program do the sharing because I didn't want all ts users to be
members of Print Operators.

-TP

Steven E. Adams

unread,
Mar 15, 2001, 12:46:13 PM3/15/01
to
Hello TP,

I am sorry if I don't understand what you are saying.

I really have no idea what "A Progam" that auto creates a printer is that
you are talking about.
Sounds too vague & cryptic for me to comprehend how yo are able to get the
UNC path to map LTP1.
Are you a programmer that wrote something custom for yourself?

I understand the making of a hidden share$ and permissions so the user can
access the printer ....
Are you saying I have to purchase a software product that executes custom
login scripts?

Thanks for your suggesions so far BTW.... }:o)

Can you be more desciptive on "The Program" you are using?


Steven E. Adams
MCP

"TP" <tperson....@mailandnews.com> wrote in message
news:3AAE4D6C...@mailandnews.com...

TP

unread,
Mar 15, 2001, 2:57:04 PM3/15/01
to Steven E. Adams
Sorry for not being descriptive enough. Yes, I had to write
programs.

The first program "program A" runs when each user logs on, in the
user's session. It gets the current default printer for the
user. (This is their local auto-created printer by ts) This info
is passed on to "program B".

"program B" is running in another user session, this user has
printer operator privileges. It shares out the printer with a
hidden sharename.
Now, the hidden share pointing to the user's default printer
exists.

"program A" does a NET USE LPT1 \\SERVER\HIDDENSHARE$

"program A" terminates because it is finished.

Paul A. Ryskin

unread,
Mar 27, 2001, 6:50:13 AM3/27/01
to
Hello!
I'm using small programm for determinate IP address of clients PC and
display it.
Sample:
tscladdr.exe -q -S"net use lpt1: \\%IP%\printer_share_name" > AttPrn.bat
then, call AttPrn.bat
this is code:

#-------
#define __DEBUG__ 0
#define _WIN32_WINNT 0x0500
#define WINVER 0x0500

#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
#include <winnt.h>
#include <Wtsapi32.h>

void auth_info(void);
void help(void);

int main(int argc, char** argv) {
BOOL rc;
LPTSTR ClntAddrInfo;
DWORD CntBytes=0;
BYTE* pByte;
char* display_str;
char tscladdr[16];
BYTE tst[20];
int i= argc;
BOOL OP_QUIET = FALSE;
BOOL OP_DISPLAY_STRING = FALSE;
unsigned int FindPos = 0;
char* display_str_begin;
char* pfind;
file://char* display_str_end;

while (--i >= 1) {
if(stricmp(argv[i],"-q") == 0)
OP_QUIET = TRUE;

if((strnicmp(argv[i],"-s",2) == 0) && *(argv[i]+2)!=0)
{
OP_DISPLAY_STRING = TRUE;
display_str = argv[i]+2;
display_str_begin = (char *)calloc(strlen(argv[i]+2)+16,sizeof(char));

pfind = strstr( display_str, "%IP%" );
if (pfind == NULL)
OP_DISPLAY_STRING = FALSE;
else
{
FindPos = pfind - display_str;
strncpy(display_str_begin,argv[i]+2,FindPos);
}
}
if(stricmp(argv[i],"-h") == 0 || stricmp(argv[i],"-?") == 0)
help();
}

if(!OP_QUIET)
auth_info();

#if __DEBUG__
pByte = tst;

pByte[2]=(BYTE)192;pByte[3]=(BYTE)168;pByte[4]=(BYTE)70;pByte[5]=(BYTE)255;
rc=1;
#else

rc = WTSQuerySessionInformation(
WTS_CURRENT_SERVER_HANDLE,
WTS_CURRENT_SESSION,
WTSClientAddress,
&ClntAddrInfo,
&CntBytes
);
#endif
if(rc) {
#if !__DEBUG__
PWTS_CLIENT_ADDRESS ClntAddr = (PWTS_CLIENT_ADDRESS)ClntAddrInfo;
pByte = ClntAddr->Address;
#endif

sprintf(tscladdr,"%-d.%-d.%-d.%-d",pByte[2],pByte[3],pByte[4],pByte[5]);
if(OP_DISPLAY_STRING)
{
if(strlen(display_str)==FindPos) {
printf("%s\n",tscladdr);
exit(3);
}
if(FindPos==0) {
printf("%s%s\n",tscladdr,display_str+4);
exit(0);
}
else
{

printf("%s%s%s\n",display_str_begin,tscladdr,display_str+FindPos+4);
}
}
else
printf("%s\n",tscladdr);
exit(0);
}
exit(2);
}

void help(void) {
auth_info();
printf("Help\n");
printf("Program for determine ip address of client terminal server and
display it\n");
printf("usage: [-S|-sSTRING] [-Q|-q] [-H|-h|-?]\n");
printf(" option -S|-s\"STRING\" - display STRING. %%IP%% substituion
by ip address.\n");
printf(" sample: -S\"print
/d:\\\\%%IP%%\\hp1100\"\n");
printf(" option -Q|-q - \"QUIET\" mode (without author
info)\n");
printf(" option -H|-h|-? - this help\n");
printf("without options - print IP address of client terminal server\n");
exit(1);
}

void auth_info(void) {
printf("Writen by Paul A. Ryskin (pa...@tih.oilnet.ru).\n");
printf("Build date:%s, time:%s\r\n",__DATE__,__TIME__);
}
#---end

Paul.


0 new messages