deibel
asked on
Print PDF as custom service SBS2008
Hi Experts,
I need your advice!
I want to print a PDF from a SBS2008 periodical once a day.
The PDF is created by another application and saved in a local folder.
This little "printservice" has to run in background with no user activity an also with no user logged into the machine.
I wrote a batchfile and configured the taskplaner to execute it.
but that doesnt work with no user logged into the machine.
so i thought i need a custom service and created one with srvany.exe
i modified the batch to an infinite loop
but that didnt work either.
This is my batchfile:
:START
start runas /profile /savecred /user:sysadmin@domain.loca l "C:\Program Files (x86)\Adobe\Reader 9.0\Reader\AcroRd32.exe /p /h c:\test\Test.pdf"
@time /T>> c:\test\test.txt
timeout /T 300
Taskkill /F /IM acrord32.exe /T
goto START
I saw, that no printer is given as argument to AcroRd32 /p so i thought it only prints to the default printer. But there is no default printer, when no user is logged in. So I tried runas with no effect.
I googled a bit an read somthing about missing rights. But I dont really understand that.
Can anybody give me an advice?
Thanks in advance
I need your advice!
I want to print a PDF from a SBS2008 periodical once a day.
The PDF is created by another application and saved in a local folder.
This little "printservice" has to run in background with no user activity an also with no user logged into the machine.
I wrote a batchfile and configured the taskplaner to execute it.
but that doesnt work with no user logged into the machine.
so i thought i need a custom service and created one with srvany.exe
i modified the batch to an infinite loop
but that didnt work either.
This is my batchfile:
:START
start runas /profile /savecred /user:sysadmin@domain.loca
@time /T>> c:\test\test.txt
timeout /T 300
Taskkill /F /IM acrord32.exe /T
goto START
I saw, that no printer is given as argument to AcroRd32 /p so i thought it only prints to the default printer. But there is no default printer, when no user is logged in. So I tried runas with no effect.
I googled a bit an read somthing about missing rights. But I dont really understand that.
Can anybody give me an advice?
Thanks in advance
found example
D:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe" /t "D:\R104-20071025165656.pd f" "\\192.168.0.4\hp" "hp LaserJet 1000" "\\192.168.0.4\hp"
D:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe" /t "D:\R104-20071025165656.pd
ASKER
no i did not.
/t is an argument for acrord32 ?
the printer is a network printer, that is locally installed on the server.
i mean, that it is not a network printer shared by a different printserver.
what do i have to type for drivername and portname?
/t is an argument for acrord32 ?
the printer is a network printer, that is locally installed on the server.
i mean, that it is not a network printer shared by a different printserver.
what do i have to type for drivername and portname?
ASKER
ok, i already googled that and use the following command:
"C:\Program Files (x86)\Adobe\Reader 9.0\Reader\AcroRd32.exe" /t "c:\test\test.pdf" "\\192.168.40.107\CM1312nf i" "HP Universal Printing PCL 6" "\\192.168.40.107\CM1312nf i"
but still the same. when i type it to cmd, it works
but when i start my batch file as service it doesnt
:-(
"C:\Program Files (x86)\Adobe\Reader 9.0\Reader\AcroRd32.exe" /t "c:\test\test.pdf" "\\192.168.40.107\CM1312nf
but still the same. when i type it to cmd, it works
but when i start my batch file as service it doesnt
:-(
ASKER
wait, i can see in taskmgr, that acrord32 is started, when i start my service.
but i cant see a printjob in the spooler of the laserjet.
i call the user to ask if something comes out of the printer.....maybe....
but i cant see a printjob in the spooler of the laserjet.
i call the user to ask if something comes out of the printer.....maybe....
can you try to run this manually on SBS2008 ?
and run "NET USE" on SBS2008 to see all available printers.
and run "NET USE" on SBS2008 to see all available printers.
ASKER
This is my new batchfile:
:START
start /D "C:\Program Files (x86)\Adobe\Reader 9.0\Reader" AcroRd32.exe /t "c:\test\test.pdf" "\\192.168.40.107\CM1312nf i" "HP Universal Printing PCL 6" "\\192.168.40.107\CM1312nf i"
@time /T>> c:\test\test.txt
timeout /T 60
Taskkill /F /IM acrord32.exe /T
timeout /T 60
goto START
i can start it manually and it works fine.
acrord opens a windows, a printjob appears in the spooler, acrord is closed and so on.
when i start it as service, i can see in taskmgr, that acrord32 ist started and killed after a minute.
but i dont see a printjob in the spooler and cant reach the user yet to ask him.
net use says: new connections will be saved, no entries in the list (translated orig. german)
192.168.40.107 in the acrord32 command is the server itself
:START
start /D "C:\Program Files (x86)\Adobe\Reader 9.0\Reader" AcroRd32.exe /t "c:\test\test.pdf" "\\192.168.40.107\CM1312nf
@time /T>> c:\test\test.txt
timeout /T 60
Taskkill /F /IM acrord32.exe /T
timeout /T 60
goto START
i can start it manually and it works fine.
acrord opens a windows, a printjob appears in the spooler, acrord is closed and so on.
when i start it as service, i can see in taskmgr, that acrord32 ist started and killed after a minute.
but i dont see a printjob in the spooler and cant reach the user yet to ask him.
net use says: new connections will be saved, no entries in the list (translated orig. german)
192.168.40.107 in the acrord32 command is the server itself
ASKER
is there any other programm that can print PDF from command line that doesnt depend on acrord?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
it is locally as i mentioned above.
i found a tool defprint, that can define default printer from command line
i give it a try
i found a tool defprint, that can define default printer from command line
i give it a try
ASKER
i got it.
there is no printer in the environment, if the batchfile is executed as service with no user logged in.
so i added Rundll32 printui.dll,PrintUIEntry /ga /n\\SBS2008\CM1312nfi to the batchfile and it works.
i will award the points, because the /t argument was useful as well.
thanks for your help
there is no printer in the environment, if the batchfile is executed as service with no user logged in.
so i added Rundll32 printui.dll,PrintUIEntry /ga /n\\SBS2008\CM1312nfi to the batchfile and it works.
i will award the points, because the /t argument was useful as well.
thanks for your help
/t <filename> <printername> <drivername> <portname> - Print the file the specified printer.