Powershell script from task scheduler partially working


hi all,

i wrote powershell script print out files in specific folder:

cd c:\script

dir -name c:\invoices\*.* > list.txt

foreach ($docid in get-content "c:\script\list.txt")  
{
cd "c:\program files\sumatrapdf\"
.\sumatrapdf.exe -print-to-default "c:\invoices\$docid"
}



sleep 30
ri c:\invoices\*.*
ri c:\script\list.txt

this work console every time.

when schedule task scheduler executing last part , ignoring part calling program print.

this driving me crazy suggestion why skipping part? have search lot , people speak variables , environment nothing seems apply case.

the task following parameters:

user:system

action:program/script

c:\windows\system32\windowspowershell\v1.0\powershell.exe

add arguemts:-file "c:\script\printinvoices.ps1"


thanks suggestion.

federico

windows 10 not option work , cliente windows 7.

anyway fixed. made work simple stupid bat using sumatra , using in task scheduler instead of powershell script working charm.

thanks help

federico



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Group Policy Event ID 1058 Error Code 1326 (The user name or password is incorrect)

Suspicious event log Event ID: 4905

DCOM received error "2147746132" from...