The script is written in VBS. Since it is moved over to Windows 2008, it has never run by the task scheduler. "Task Start Failed" always occur with the default error code 2147750687 regardless of logon. The script runs well under the command prompt.
The following is the task setting:
- Run under the local Administrator account
- Run whether user is logged on or not
- Run with highest privileges
I have been researching this problem for 2+ weeks and I am still unable to resolve it. Then I wrote a very simple script to see where it fails. The script only contains the following 4 lines.
I also tried to specifically add "Administrator" into Local Security Policy for "Log on as a batch job" (see Local Security Policy -> Local Policies -> User Rights Assignment -> Log on as a batch job). It is no help to this problem.
I tried again with my XP box. Everything is fine.
I guess the problem could be related to the User Security Context under task scheduler 2.0. Unfortunately, I am still unsure where or how I can make the task to run or access the resource.
Is there anyone who has an idea how to fix this? As I mentioned, the task is run under local administrator and has elevated with the highest privileges. The script runs fine in a command prompt but not a scheduled task. Do I miss some important settings? How can I run a task that is written in VBS and needs to access (read/write) into the resource under Windows 2008 server? Any pointer is appreciated. Thanks.
The following is the task setting:
- Run under the local Administrator account
- Run whether user is logged on or not
- Run with highest privileges
I have been researching this problem for 2+ weeks and I am still unable to resolve it. Then I wrote a very simple script to see where it fails. The script only contains the following 4 lines.
Set oScript = CreateObject("WSCRIPT.SHELL")
Set oFileSys = CreateObject("Scripting.FileSystemObject")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("ftp\tmp.txt")
It looks like that the script fails when it is trying to call CreateTextFile(). If I comment the last line, the task for this script can be completed without an error.Set oFileSys = CreateObject("Scripting.FileSystemObject")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("ftp\tmp.txt")
I also tried to specifically add "Administrator" into Local Security Policy for "Log on as a batch job" (see Local Security Policy -> Local Policies -> User Rights Assignment -> Log on as a batch job). It is no help to this problem.
I tried again with my XP box. Everything is fine.
I guess the problem could be related to the User Security Context under task scheduler 2.0. Unfortunately, I am still unsure where or how I can make the task to run or access the resource.
Is there anyone who has an idea how to fix this? As I mentioned, the task is run under local administrator and has elevated with the highest privileges. The script runs fine in a command prompt but not a scheduled task. Do I miss some important settings? How can I run a task that is written in VBS and needs to access (read/write) into the resource under Windows 2008 server? Any pointer is appreciated. Thanks.