Running a console application as the System user via Scheduled Tasks [Windows 2008]
-
I have written a console app in VB.net. Basically it reads some information from a couple Excel files, takes the information contained within and goes to that device on our network to poll for more information. This information is then dumped into a new different Excel file. I am able to run the application via debug and all works great. I can also run it manually via .exe and all works great. The problem comes in when i attempt to create a scheduled task (every hour) to run as the System user. My error logging shows that it is not able to access the Excel files (which previously worked when run as admin). I have tried to troubleshoot by specifically setting the file permissions for that folder/file for the System user. Could someone shed any light on why I am running into this problem? Thanks! -Steve
-
I have written a console app in VB.net. Basically it reads some information from a couple Excel files, takes the information contained within and goes to that device on our network to poll for more information. This information is then dumped into a new different Excel file. I am able to run the application via debug and all works great. I can also run it manually via .exe and all works great. The problem comes in when i attempt to create a scheduled task (every hour) to run as the System user. My error logging shows that it is not able to access the Excel files (which previously worked when run as admin). I have tried to troubleshoot by specifically setting the file permissions for that folder/file for the System user. Could someone shed any light on why I am running into this problem? Thanks! -Steve
a lot of errors like this are caused by account issues - the scheduler usually runs as a particular account - with no standard user environment - so try to fully specify paths etc to the files. Depending on the o/s, you could change the scheduler to use a particular account's credentials - this may throw other scheduled apps out, especially if they require desktop/gui access The other thing I do is use a 'runas' type program to impersonate the user, including load the registry hive etc, so that the environment is correct - the [in this case 'Excel manipulation program'] is then running under a real user not a limited system account {ps : I use tqcrunas from a company called 'Quimeras' - Im not affiliated with them in any way, but its a great product that allows me to encrypt/protect credentials/command sets - they are really good at support btw} 'g'
-
I have written a console app in VB.net. Basically it reads some information from a couple Excel files, takes the information contained within and goes to that device on our network to poll for more information. This information is then dumped into a new different Excel file. I am able to run the application via debug and all works great. I can also run it manually via .exe and all works great. The problem comes in when i attempt to create a scheduled task (every hour) to run as the System user. My error logging shows that it is not able to access the Excel files (which previously worked when run as admin). I have tried to troubleshoot by specifically setting the file permissions for that folder/file for the System user. Could someone shed any light on why I am running into this problem? Thanks! -Steve
in addition to the tqcrunas product [just to prove Im not biased], Wingnut software also make such a product http://www.wingnutsoftware.com/[^] see 'Encrypted runas' 'g'
modified on Sunday, December 27, 2009 9:21 PM
-
a lot of errors like this are caused by account issues - the scheduler usually runs as a particular account - with no standard user environment - so try to fully specify paths etc to the files. Depending on the o/s, you could change the scheduler to use a particular account's credentials - this may throw other scheduled apps out, especially if they require desktop/gui access The other thing I do is use a 'runas' type program to impersonate the user, including load the registry hive etc, so that the environment is correct - the [in this case 'Excel manipulation program'] is then running under a real user not a limited system account {ps : I use tqcrunas from a company called 'Quimeras' - Im not affiliated with them in any way, but its a great product that allows me to encrypt/protect credentials/command sets - they are really good at support btw} 'g'
1. All file paths are absolute. 2. The scheduler for 2008 needs the System account to run scheduled tasks without being logged in as far as I have been able to tell. I have a scheduled task to download a weather map every 10 minutes and would only run using the System account. 3. I attempted to use runas via the command line for the System user however, the password was prompted for, which is not known.
-
1. All file paths are absolute. 2. The scheduler for 2008 needs the System account to run scheduled tasks without being logged in as far as I have been able to tell. I have a scheduled task to download a weather map every 10 minutes and would only run using the System account. 3. I attempted to use runas via the command line for the System user however, the password was prompted for, which is not known.
reply to 3. yep, thats the issue with the standard runas - there are some programs Ive seen that allow you to pass a password to runas Can you create a seperate user account and test the excel bit under that - if you can use 'runas' and your user account to run the excel bit, then you can use one of the other [encrypted] runas tools I suggest to finish the automation I still think its your system account vs COM components that EXCEL might be using thats giving you the issue - Ive had the same issue on Windows 2003 server 'g'