Windows Server 2008 R2 (SP1) - Task scheduler - task fails with return code 1
Hello everyone, Im trying to schedule a VB script to run through Task scheduler. This VB scrip compresses old IIS log files (from path C:\inetpub\logs\LogFiles) and then deletes the original logs to save disk space. Now I can manually run this VB script fine but when use task scheduler to run this script (using my credentials) it fails with last run result (0x1). Any suggestion how I can troubleshoot this? Many thanks in advanced! This is what I use when I successfully can run the script (manually). C:\Windows\System32>cscript "C:\inetpub\logs\LogFiles\zipTHIS.vbs" "C:\inetpub\logs\LogFiles" Job history log: Log Name: Microsoft-Windows-TaskScheduler/Operational Source: Microsoft-Windows-TaskScheduler Date: 6/9/2012 2:30:02 AM Event ID: 201 Task Category: Action completed Level: Information Keywords: User: DOMAIN\USER Computer: SERVER.DOMAIN.global Description: Task Scheduler successfully completed task "\Zip IISLogs" , instance "{b33ab166-740d-48fd-a908-04a8a39b89f1}" , action "C:\WINDOWS\system32\cscript.exe" with return code 1. Event Xml: <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Microsoft-Windows-TaskScheduler" Guid="{DE7B24EA-73C8-4A09-985D-5BDADCFA9017}" /> <EventID>201</EventID> <Version>1</Version> <Level>4</Level> <Task>201</Task> <Opcode>2</Opcode> <Keywords>0x8000000000000000</Keywords> <TimeCreated SystemTime="2012-06-09T06:30:02.091455500Z" /> <EventRecordID>27962</EventRecordID> <Correlation ActivityID="{B33AB166-740D-48FD-A908-04A8A39B89F1}" /> <Execution ProcessID="6776" ThreadID="5872" /> <Channel>Microsoft-Windows-TaskScheduler/Operational</Channel> <Computer>SERVER.DOMAIN.global</Computer> <Security UserID="S-1-5-21-1591436961-3927856366-2354756760-6190" /> </System> <EventData Name="ActionSuccess"> <Data Name="TaskName">\Zip IISLogs</Data> <Data Name="TaskInstanceId">{B33AB166-740D-48FD-A908-04A8A39B89F1}</Data> <Data Name="ActionName">C:\WINDOWS\system32\cscript.exe</Data> <Data Name="ResultCode">1</Data> </EventData> </Event> BlueSky2010 Please help and appreciate others by using forum features: "Propose As Answer", "Vote As Helpful" and "Mark As Answer"
June 11th, 2012 5:07pm

HI, I've been researching a Task Scheduler issue that I'm having on Server 2008. I stumbled across an article about the Task Scheduler not able to run a batch file that contains " " quotation marks. http://support.microsoft.com/kb/951246. This didn't relate to me because I don't have quotation marks in my batch file, but I read it anyway and then saw your post. Hope it helps!
Free Windows Admin Tool Kit Click here and download it now
June 11th, 2012 10:44pm

Hello, As the script works when run manually, its often caused by insufficient permission or using a mapped drive. If the script involves a mapped drive (e.g. z:\), use the full path \\servername\foldername instead of just using z:\. You should also make sure that your credential have sufficient permission to all the directories involved all through the task. Some others solved such problems by typing in the full path to the .bat file in the Start In(optional). You can have a try. Thanks Zhang
June 11th, 2012 11:15pm

HI, I've been researching a Task Scheduler issue that I'm having on Server 2008. I stumbled across an article about the Task Scheduler not able to run a batch file that contains " " quotation marks. http://support.microsoft.com/kb/951246. This didn't relate to me because I don't have quotation marks in my batch file, but I read it anyway and then saw your post. Hope it helps! Hmm... the KB says this issue in for Windows Server 2008 and Vista. I wonder whether it affects R2 as well. I've quote in the script - I'll give this a try remove the quote and see how that goes (trying to avoid the hotfix :-)). BlueSky2010 Please help and appreciate others by using forum features: "Propose As Answer", "Vote As Helpful" and "Mark As Answer"
Free Windows Admin Tool Kit Click here and download it now
June 12th, 2012 10:09am

Hi Cheers, To your questions - 1. I've no map drives invlolved 2. my account is a local admin and has full permission (I can run this script manually which indicates NOT a permission issue) 3. I already have full path of the VBS file in the 'Start In' (see below). Any other thoughts? BlueSky2010 Please help and appreciate others by using forum features: "Propose As Answer", "Vote As Helpful" and "Mark As Answer"
June 12th, 2012 10:18am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics