Citrix local printer can't print to.

I have a local networked printer in my office that works fine.
I connect via Citrix to my customer and I can see it in 'Devices and Printers'.
I can use Notepad in the Citrix session to print by selecting this printer and it will print in my office.
I have a DOS program in the Citrix session that I want to print data to this printer from the Citrix session.
I just want to print something out from DOS and eventually maybe from Access.
I am only a user on a customer's tied down session ie no cmd line
I can create a batch file and run it but CMD won't work.
I can't share the printer in my session but I can see it and print to it from Notepad.
Since I can print to my local printer, on my network, from Notepad in the Citrix session it is not considered a support issue by my customer's third party Citrix support, so they won't help.
My local printer is called 'LOCALPRT" and prints from Notepad in the Citrix session.
I have tried NET USE LPT1: "\\CLIENT\LOCALPRT" and it brings up a prompt wanting a userid and password. Nothing I enter works.
I have tried using the computer name as \\MY-PC\ where 'MY-PC' is the computer name and that doesn't work.
'wmic printer get name, default' shows my printer is there in 'Session 1'.

My question is , how do I print from a batch file in my Citrix session?

I know nothing about Citrix but do know how to write batch files and map drives etc.  

TIA
spiantaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CoralonCommented:
Because it is a network printer on your side, it is going to be near impossible to print directly from a cmd line to that printer.  However ---- you may be able to do it indirectly.  

Since you have the ability to set up a batch file in your Citrix session, you have some possibilities.  
Assuming you don't have any port redirection available to you..

You would use a batch file with your port redirection to output stdout to a file, and then copy the file locally and print it to your system, or print it to a file, open it in notepad in your Citrix session and then print it to your printer.

type file.txt > "%userprofile%\outputfile.txt"
copy "%userprofile%\outputfile.txt" \\client\c$
or you would open the file in notepad on the Citrix session and print it from there.

Using Access, you can just print to the default printer without an issue.  

If you want to map a port, if it is available, then you could:
net use COM3: \\client\com1$
net use LPT2: \\client\lpt1$
etc. Basically, you can map any of the remote com ports or lpt ports directly to your system through a batch file.  Again --- IF it is enabled.

If it is, then you could map the LPT port you would:
set up a local generic/text printer in your side, and set it to print to file.
Then you in your batch file you would do something like:
net use lpt1: \\client\lpt1$
type filename.txt > lpt1:

Then, on your own system, you should see the generic text printer "activate" and ask you to save the file.  (Untested, but the theory is relatively sound).  At that point you would open it in your local notepad and print it to your network printer.

But, I would go with the temporary file route.. that's going to be the easiest way to accomplish what you are trying to do.

Coralon
joharderCommented:
When you say a DOS program, do you mean that it's just a batch script?  Or is truly a DOS program?

Two ideas come to mind: this DOS program doesn't recognize your printer (after all, DOS is how many years old?).  Also, it is possible that this DOS program is attempting to map your printer as an LPT port and the LPT port is disabled.  

If it is the latter, you'll need to ask the Support folks to enable LPT port for printing for you as it must be done via a Citrix policy.  They may or may not be willing to oblige since LPT port printing is rarely used anymore.
Brian MurphyIT ArchitectCommented:
You stated networked printer?  Networked how?

Does it have a Jet Direct card or box?

Is it hosted on a file server?

Regardless, LPT and Parallel won't work.

If you cannot add it to a Windows File and Print Server and \\printserver\myprinter

Then it would have to support LPR printing or it is NOT a networking printer.

If it is attached to a host by USB or Parallel you must share that printer from that workstation or server.  LPR would not be an option.

So it is either a Networking printer supporting LPR or attached to a computer that is networked?

I don't want to make any assumptions so if you could provide more details on the aforementioned items above we have a much greater probability of providing the answer.

Also, when I see DOS I think of Server 2000, 2003 32 bit or Windows 95/98

If your running DOS your not doing it on a 64 bit platform.

At best we are talking Windows 7 32 Bit or earlier or you are actually referring to a DOS workstation running the old IBM LANMAN 1 protocol or Windows for Networking.

Can you elaborate?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

spiantaAuthor Commented:
>You would use a batch file with your port redirection to output stdout to a file, and then copy the file locally and print it to your system, or print it to a file, open it in notepad in your Citrix session and then print it to your printer.
Yes this is what I am currently doing. I print to a \\CLIENT\C$ and do a redirect.

>you can map any of the remote com ports or lpt ports directly to your system through a batch file.  Again --- IF it is enabled.
Doesn't appear to work, although I can print from Notepad.

>When you say a DOS program, do you mean that it's just a batch script?  Or is truly a DOS program?
Batch script under a Citrix session that says it is Windows Server 2008R2 Standard

You stated networked printer?  Networked how?
IP via DLink Print Server.  It does support LPR which I will check out but unless I hear better I will go with a print to C$ and print from there.

Also, when I see DOS I think of Server 2000, 2003 32 bit or Windows 95/98
Apologies, old habits die hard,  it is a .BAT file under CMD.

I guess I thought that since Notepad in the Citrix session could see the printer then it would be straightforward. Especially since I get this message below when using NET USE LPT1: "\\CLIENT\LOCALPRT"
Enter the user name for 'CLIENT':

Also    notepad /PT "test.txt" "LOCALPRT"   or variations thereof don't work eg \\CLIENT\LOCALPRT

I guess my question should be is that the Windows Apps can print to it and so how can I achieve that in a CMD .BAT file?
Brian MurphyIT ArchitectCommented:
Yea. Just adds to my confusion at this point.

When I look at that last part it would be a local printer attached to LPT1?

Your trying to mount a LPT1 Port?

If you have the actual printer local and it works why not simply "Share" your printer and then user \\myworkstation\myprinter

That is Windows File and Print Services.

Your workstation or that workstation that can print acts as the Print Server.
joharderCommented:
This boils down to what it is that your BAT file does.  Because you can print from Notepad, we know that printing works in the Citrix environment.  

Your BAT may be calling up functionality that doesn't support printing.  Also, that BAT may be hosted on a distinct server that specifically has printing disabled.  

Can you provide the contents of the BAT file?  Of course, cover up anything proprietary.
CoralonCommented:
You can't print from the cmd prompt directly to a Client printer in CItrix unless it is tied directly to a local port on the client (LPT or COM).  

Coralon
Brian MurphyIT ArchitectCommented:
It sounds like I might have missed something.

How does running a batch file that uses LPT prove Citrix works?

Net Use is a Windows CLI.

It will print with or without Citrix.

I think we are missing some key details.
spiantaAuthor Commented:
I have created a workaround so the 'problem' is solved but I will answer your questions as a thanks for assistance.  My work around is to get the client to print the files to a server directory. My Citrix session then monitors that directory and as the files appear copies the print files to \\Client\C$\printme and then a local program (from DOSPRN.com) prints them out.  Works well if clunky.

>It sounds like I might have missed something.
I have tried to include everything I can think of and have done,  also to describe how I see the environment, as best as I can.

>When I look at that last part it would be a local printer attached to LPT1?
The local printer is IP based running off a print server.  The idea, one of a few, was to map it through as LPT in Citrix so the 'type' or 'print' etc commands might work.

>If you have the actual printer local and it works why not simply "Share" your printer and then user \\myworkstation\myprinter
I am not allowed to Share the printer because the Citrix admin's won't let me.  Their response is that it prints from Notepad so everything is fine therefore no need to Share.  I don't have the authority to share the printer.
If you mean, share locally and then use '\\myworkstation\myprinter' then that is what I actually want to do but it asks for a userid and password and nothing I enter works.

>This boils down to what it is that your BAT file does.  Because you can print from Notepad, we know that printing works in the Citrix environment.  
Yes it prints from Notepad but I can't get use any commands in a BAT file to printout. Even 'Notepad /PT "test.txt" "LOCALPRT"'   or variations thereof don't work eg \\CLIENT\LOCALPRT.  It seems that Citrix sees the printer at the 'Notepad' level but not the BAT level.

>Your BAT may be calling up functionality that doesn't support printing.  Also, that BAT may be hosted on a distinct server that specifically has printing disabled.  
The BAT file is on my local Citrix desktop.  The bat files are not complicated and just were testing examples of 'Notepad /PT "test.txt" "LOCALPRT"'   or variations thereof eg \\CLIENT\LOCALPRT and TYPE and COPY etc.

>You can't print from the cmd prompt directly to a Client printer in CItrix unless it is tied directly to a local port on the client (LPT or COM).  
I tried that with 'net use LPT1:  "LOCALPRT" '   or variations thereof eg \\CLIENT\LOCALPRT but the mapping did not take.

>I think we are missing some key details.
I have tried to list everything and answer all questions but I accept I may not have been as clear as I could be but really this is all there is.

I have done lotsss of searching on the web and it seems many people have referenced the same sort of problem.  They can see their local printer in the Citrix session and print from Notepad, Word etc but can't print from a BAT file.

I am happy to answer more questions but I will be sticking with my workaround.

Thank you all for your assistance.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Brian MurphyIT ArchitectCommented:
Well, at least it is working.  Seems a little extreme and somehow I missed the print server and where the LPT1 port.  I thought those were extinct.  

So for my on sanity.  You do have a printer on the network with an IP address but for some reason you are not able to print directly to that printer you have to save the files to a share that is actually your C: drive?  

At this point I'm just wondering why this is so difficult.  I'll take one more crack at it;

So you are having to save a file or files to a server, a server that is not a Citrix server and you have a Citrix session on the same IP subnet and then we have a Network printer that is not configured on the server as a printer?  

My next question would be, if you have a IP printer or JetDirect box or whatever you can download the drivers and install those drivers on the server not CItrix on the server you share the files and there is an option for IP Printing.  You put in the IP Address of that printer and hit next and it says I'm going to share this printer what do you want to call it?  

So, assume we call it Printer.  Now from your citrix client you can map a printer to \\SERVER\PRINTER

Or even better, lets go for easiest way possible - setup the printer on the print server and obviously select the drivers you downloaded for that printer, share that printer then from you citrix client click on Start, Run and type \\server\ ENTER

You will see a printer named "Printer" and when you double click that icon it will automatically do whatever it needs to do so then you have a printer that you can choose or in your case "send output" as if it were a network printer.

Where I got confused was the \\something concept which only works in Windows with Windows File and Printer enabled on your IP stack.

If you have an IP printer or JetDirect box or anything other than a Windows server hosting that printer it just doesn't work that way.  If you do JetDirect you must install the software first.  If you want to print to that printer directly with windows to a nonwindows hosted printer it doesn't understand the \\ concept.  The double whack concept goes all the way back to the days of Windows for Workgroups and LANMAN 1.0 created by IBM.

And so if you have a Windows "server" as in not Windows 7 but maybe 2008 R2 all you have to do is click on server manager and add that feature and a somewhat decent MMC tool to configure printers and file shares and doing that it doesn't matter what your printing for the most part if you just take the time to add the right driver the Spooler service or aka spoolsv.exe will take that RAW output and send it to the IP printer directly in a language that printer understands and formatting and so forth is where the printer driver does its thing.  

At that point unless I'm just too tired to comprehend everything you have a printer now on the print server that is talking to the Dlink LPR device.

So your going to have a LPT# and the command line is
net use lptx \\printserver\printername

I havent used dlink in a long time so I don't recall if it supports direct output from Windows.

What I mean by that is printing directly to the dlink.   You need something in the middle that supports Windows printing and binding that driver for the printer once it hits the dlink device.  Otherwise your just sending this raw output to an IP address but missing instructions on how to build it.  

So the part about the client is not really necessary.  The printer is hosted and bound to a driver that matches that printer behind the dlink device.

I mean at very least it saves you a few steps with that copy here then there now print.

I'm not familiar with the other commands as written above.  TO print from notepad to a printer you would have to output symbol.

Maybe that is what you need.  Now that is where having a driver bound is useful but if you open command prompt you don't need to prefix with notepad I dont think the notepad test.txt would work because that says hey notepad open this file.

What you need is something that can parse the file and output to a printer

Like "Type text.txt > \\server\printer

I don't think would know to open the file then print it.

It would just open the file and you would go to file print and put the UNC Path and printer name as above but without the > (output) character

I believe it even works with ECHO

Like

echo "print test" > \\servername\printer

Like in this example with a program that offers a switch for printing would not work as
Notepad /PT "test.txt" "LOCALPRT"

You would have to use SET first to create a variable that DOS understand.  

SET MYPRINTER= \\servername\printername
SET FILE= C:\printme

Notepad /PT %FILE% %MYPRINTER%
Brian MurphyIT ArchitectCommented:
Something else I recall is print.exe

I just don't recall what the /D:Device supports

You would still create the variable just for purposes of clean look if anything
SET MYPRINTER= \\servername\printername
SET FILE= C:\printme

print /D:%MYPRINTER%\%file%

Or you could just
print /d:\\server\printer c:\letter.doc

I guess the point here is the syntax and a server hosted on Windows Server

But with that, there are print server devices or boxes that might support direct print

Regardless, there is something\printer

print /d:\\10.10.10.5\DLINK

The problem with this last one is your not telling it how to print.  The DLINK doesn't exist unless you create it.  Maybe there is a software or maybe it has a web gui for example.

Somewhere in there you would have to configure a share or printer name to go along with the device name.  

I used the IP address because it probably is not listed in DNS.

One or all of these will work.  You might even try print /D:10.10.15.5

The IP address of that DLINK device

It is very possible that it allows direct print using the IP address
joharderCommented:
Please go back and ask the Citrix administrators whether the LPT port is disabled.
hdhondtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Citrix

From novice to tech pro — start learning today.