Solved

Use a batch file to transfer and print a file on a print server

Posted on 2013-05-12
7
1,091 Views
Last Modified: 2013-05-13
Hi,

I am trying to get the attached batch file to send and print a file to our print server.

The batch file works on our old print server which is a windows 2003 server and a domian controller.

When I go to run it on our new print server which is Windows Server 2008 R2 and also our Active directorey server I get Access is denied as per attached jpeg. If I run the job as a Domain Admin it works fine. I have given a test account full print, manage printer and manage documents and still no luck.

i have also disabled the firewall on the print server and terminal server and still get the same access denied message.

I know it is a permissions issue but am not sure where to go and look now.

Thanks Mark
Access-Denied.JPG
PRN-batch.txt
0
Comment
Question by:Balco
7 Comments
 
LVL 23

Expert Comment

by:Nagendra Pratap Singh
ID: 39160435
Is it a scheduled task?

You can make it a scheduled task and feed domain creds.

You can run that command manually.
0
 
LVL 6

Expert Comment

by:nettek0300
ID: 39160436
My guess is that the test account does not have access to read the file from the Windows 2008 R2 server.  I would verify the permissions on the temp directory to make sure the test account has access to the file.  Are you able to sign on to the server using the test account and read the file?
0
 

Author Comment

by:Balco
ID: 39160451
Hi,

This is not a scheduled task.

Yes the test account can access the file on the terminal server as it can copy it to another folder. What it cant do is copy the file to the print server queue.

Cheers
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 23

Expert Comment

by:Nagendra Pratap Singh
ID: 39160479
Make it  a scheduled task with no further occurrences.

Ask the normal user to execute this task to copy / print the files.
0
 

Author Comment

by:Balco
ID: 39160480
All I wont the user to do is click on a file when they receive it and it prints. the print files have a .pclz extension which I have setup to be associate with the batch file when clicked on.

The print file is never the same, so I dont see how a scheduled task can work.
0
 
LVL 7

Accepted Solution

by:
eerwalters earned 500 total points
ID: 39162245
If you want to use a batch file, the smoothest way is to remove Windows permissions and standard Windows shared print queues from the equation.

There will be 5 basic steps to resolve the issue
    1- Setup the printer on the Windows 2008 server
    2- Install LPD print service on the Windows 2008 server hosting the desired printers
    3- Install LPR port monitor on the workstation(s) from which you want to send the file
    4- Modify your bat file to set the desired host and printer name
    5- Test the bat file

Step 1 - Setup the printer on the Windows 2008 server
    a- I am assuming that this step is already completed on the server and the printer is printing from the server

Step 2 - Enable LPD Service on the Windows 2008 server hosting the desired printer(s)
  If Server Manager loads after logging in, jump to item b, otherwise...
    a- GoTo Start and type servermanager.msc in the search box and hit Enter
    b- Click on Add Role Services on the right
      under Roles | Print and Document Services | Roles Services
    c- Enable the LPD Service
    d- Click on Next
    e- Click Install
    f- Click Close
    g- GoTo Start
    h- Type services.msc in the search box and hit Enter
    i- Start the LPD Service if it is not started

Step 3 - Enable LPR on the Windows 7 workstation(s) that will need to send the file
    a- GoTo Start and type appwiz.cpl in the search box and hit Enter
    b- Click on Turn Windows features on and off in the left pane
    c- Click the + sign next to Print and Document Services
    d- Enable the feature for LPR Port Monitor
    e- Click OK
    f- You may be prompted to Restart

Step 4 - Modify your batch file to set the variables for the desired printer
    Notes:    
      a- The printer_host is the DNS name or TCP/IP address of the Windows 2008 print server hosting the desired printer
      b- The printer_name is the name of the printer on the Windows 2008 print server
      c- You should try the LPR command manually first to insure success before putting it into the batch file
******************************************************
rem -----------------------------------------------------------
rem -- When the printer is on an LPD Host
rem -----------------------------------------------------------
set PRINTER_HOST=LPDserver
set PRINTER_NAME=myUSBprinter


rem -----------------------------------------------------------
rem -- LPR the source file to the hosted printer
rem -----------------------------------------------------------

type %1 > %TMP%\aqhc.tmp
LPR -S %Printer_Host% -P %Printer_Name% c:\\BSM\Temp\aqhc.tmp
pause
del %TMP%\aqhc.tmp
del %1
********************************************************

Step 5 - Test the batch file

Notes:
  If the device that needs to send the file is not a Windows 7 PC (Step 3), let me know the OS version and I can provide specific instructions on how to enable LPR for that OS.
0
 

Author Closing Comment

by:Balco
ID: 39163668
Hi,

Thanks for the solution, it was very easy to follow.

Cheers Mark
0

Featured Post

Don't lose your head updating email signatures!

Do your end users still have the wrong email signature? Do email signature updates bore you or fill you with a sense of dread? You can make this a whole lot easier on yourself by trusting an Exclaimer email signature management solution. Over 50 million users do...so should you!

Join & Write a Comment

I was supporting a handful of Windows 2008 (non-R2) 2 node clusters with shared quorum disks. Some had SQL 2008 installed and some were just a vendor application that we supported. For the purposes of this article it doesn’t really matter which so w…
A procedure for exporting installed hotfix details of remote computers using powershell
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now