how to schedule a task when user is logged off wndows 7

debashishmishra

Honorable
Aug 25, 2013
4
0
10,510
Hi,
I am having a problem while trying to schedule a task when the user account is logged off. My program works fine when the the user account is logged on.

Below is the summary what I am trying to do in my program:-
"I am scheduling a task to call an access macro which in turns call a mdb file to retrieve some data from oracle database. I have set the ODBC connection to fetch the data from oracle database and it is working perfect. Then I have written an email module in access VBA to sent record set output to some recipients."
Now the problem is sceduling the task when the user account is logged on it is running and publishing the email perfectly, but when the user account logged off, it is not happening. Could you please help ?

I have enabled the option "Run whether the user is logged on or not" and checked the option "Run with higher Priviledges".

Any fix please ??

Thanks,
Mishra
 
Solution
Run with higher priveleges doesn't always seem to be the same as run as administrator. Make sure the account it runs as has permission to write the file to that folder.

debashishmishra

Honorable
Aug 25, 2013
4
0
10,510
Hello,
I further drive down into some more research and found the below points.
I observed that the whole process is working when I am saving the oracle fetched record set into a text format file and the email are also being published correctly.
But in my code I am trying to save the record set output from the Oracle database to an excel file which is actually not happening. My understanding as of now seems that when the user account is logged off the excel application is being initiated, but failed to perform its job of saving the output file into the hard drive and emailing.

I am wondering if it is possible to work with excel application when user account is logged off. Do anyone advise some tips over this fact?
Really appreciate your valuable feedback to resolve this issue.
Thanks,
Mishra D
 

debashishmishra

Honorable
Aug 25, 2013
4
0
10,510
Dear All,
I made some changes and it appears to work like a charm. The issue like I previously stated that the excel is creating some issue.
I found that the excel file was not able to save the record set output when the user account is logged off.
So You have to create a folder (or two on a 64bit-windows):

(32Bit, always)
C:\Windows\System32\config\systemprofile\Desktop
(64Bit)
C:\Windows\SysWOW64\config\systemprofile\Desktop
After creation of the folder, my program is working fine.
I found the above trick in the below link.
http://social.technet.microsoft.com/Forums/windowsserver/en-US/aede572b-4c1f-4729-bc9d-899fed5fad02/run-powershell-script-as-scheduled-task-that-uses-excel-com-object

Hope this helps. Thank You!