powershell - Unable to print PDFs or office documents via Scheduled task -


i have scheduled task set run on machine overnight. task iterate through folder printing files found therein. can run process without issue while logged in not print when run via scheduled task.

more info:

the scheduled task executes powershell script performs multiple functions such generating , emailing reports, copying files across network folders , printing contents of folder. of these tasks performed without error if executing account logged in. if account not logged in , run via scheduled task except printing of office , pdf documents works correctly (text documents print fine).

here function using print documents.

function print-file($file) {     begin     {                        function internal-printfile($thefile)         {                 if ($thefile -is [string])             {                 $filename = $thefile              }                  else              {                  if ($thefile.fullname -is [string] )                 {                      $filename = $thefile.fullname                  }              }              $start = new-object system.diagnostics.processstartinfo $filename             $start.verb = "print"             [system.diagnostics.process]::start($start)                              }          if ($file -ne $null)          {             $filespecified = $true;             internal-printfile $file         }     }          process     {         if (!$filespecified)         {             $test = write-host process ; internal-printfile $_          }      } } 

when running scheduled task can see process start (winword or acrord32) dumping output text file not see print. 1 other difference noticed when use function while logged in applications other adobe reader (office apps) start print document close. when run scheduled task applications not close on own.

i appreciate feedback, suggestions or pointers @ time have hit wall far knowing else can check. take suggestions alternative way accomplish printing of files. (note: cannot predict file type in folder)

note: these symptoms present on 2 machines, windows server 2008 , windows 7, both running office 2007 , adobe reader 10.1.7

i'm trying same thing attempting. i'm pretty sure you're running session 0 isolation. can read more @ this msdn site , this windows blog post.

i haven't tried suggestions in following answer question on so, might worth try. creating desktop-folders session 0

here guy trying print without having user logged machine. there answer claims know how we're trying do, doesn't post answer.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -