Task Scheduler Success on 2008 R2 but failure on 2012 R2

Hi
I have currently got an issue with a Scheduled Task. It does not appear to run and returns a Last Run Result of (0x1).
So I went back to basics and created a simple task and compared between 2008 R2 and 2012 R2. On 2008 R2 the task completes and returns (0x0), on 2012 R2 the task returns (0x1).
The Service Account that runs the task is a member of the Administrators Group on both servers.
The task is to run a batch file that outputs the content of C:\ to a file called list.txt.
@ECHO OFF
DIR C:\ > C:\Temp\list.txt
Options that are selected are as follows:
Service Account set to Domain Account (Password is correct);
Run whether user is logged on or not;
Run with highest privileges;
No Trigger set (task is run by right clicking);
Action is Start a program (Program/script = TestScheduleTest.cmd, Start in optional = C:\Temp);
Start the task only if the computer is on AC power;
Stop if the computer swtiches to battery power;
Allow task to be run on demand;
Stop the task if it runs longer than 3 days;
If the running task does not end when requested, for it to stop.
Any ideas why on a 2012 R2 this would fail?
Regards

I would recommend referring to that: https://social.technet.microsoft.com/Forums/windowsserver/en-US/57c65328-d8c8-4e13-9b51-e017ae6c298c/task-scheduler-returns-0x1-code-when-run-whehter-user-is-logged-on-or-not-options-selected?forum=winserverManagement
Mainly check that the account you use to run the scheduled task has the required privileges to run it (You can running the script with
runas option in CMD and check if you get errors). Also, it might be possible that the batch file requires a privilege elevation.
This posting is provided AS IS with no warranties or guarantees , and confers no rights.
Ahmed MALEK
My Website Link
My Linkedin Profile
My MVP Profile

Similar Messages

  • Is there are way to reinstall task scheduler on server 2008 r2?

    I have a server 2008 r2 and the backups are not running so I checked the task scheduler and there were corrupted task images. I then repaired them. Now when I schedule backup in the server manager, it always hangs at scheduling backups.
    I've run sfc /scannow but no positive effect. I've searched if there is a way reinstall task scheduler on server 2008 r2?
    I'm planning on re-installing .NET 4.0. Will it resolve the problem?

    Hi Benaro,
    Re-install .NET 4.0 may not help on this issue.
    Here are some common steps to troubleshoot Schedule Task issues. Please try them first:
    http://blogs.technet.com/b/askperf/archive/2009/04/13/tsk-scheduled-task-does-not-run.aspx
    If issue still exists, please try to delete all manually created tasks and as the article said, try a simple task like start notepad.exe to see if schedule task is actually working or not. 
    If you have any feedback on our support, please send to [email protected]

  • Task scheduler in windows 2008 R2 cluster.

    We have clustered server and there's two nodes - Active(A1)/Active(A2).
    Ordinary client can connect A1, but A1 is failed then connect A2 by windows 2008 R2 cluster.
    We have a task scheduler exe module created by .net framework in each node.
    When A1 server is operated, we wanna just A1 job scheduler active.
    And A2 server is operated, just only A2 job scheduler acitve.
    Can We contoller  this situation in exe module or Failover Cluster Manager?
    parky

    If you upgrade to Win2012 or higher you can.  Here's a blog on it:
    http://blogs.msdn.com/b/clustering/archive/2012/05/31/10312527.aspx
    Thanks!
    Elden

  • Incremental and Full backups using WBADMIN and Task Scheduler in Server 2008 R2

    I'd like to create an automated rotating schedule of backups using wbadmin and task scheduler, which would backup Bare Metal Recovery; System State; Drive C: and D: to a Network Share in a pattern like this:
    Monday - Incremental, overwrite last Monday's
    Tuesday - Incremental, overwrite last Tuesday's
    Wednesday - Incremental, overwrite last Wednesday's
    Thursday - Incremental, overwrite last Thursday's
    Friday - Incremental overwrite last Friday's
    Saturday - Full, overwrite last Saturday's
    I need to use the wbadmin commands within the Task Scheduler and do not know any of the required Syntax to make sure everything goes smoothly, I do not want to do this through the CMD.

    I know each backup for the previous corresponding day will be replaced, how do you figure I wont be able to do incremental backups...
    Because incremental backup is based on Volume Shadow Copy (VSS) feature and due to Windows Server 2008 R2 limitations (this limitation is resolved in Windows 8) only one version of backed up data can be stored in a shared folder. So the
    result is that every time you back up some data on a shared folder, you actually creating a full backup of them.
    is it not supported through task scheduler?
    The Task Scheduler is only a feature that does the tasks that you have defined for it. Actually it runs the
    wbadmin command that runs on an operating system with the mentioned limitation.
    I know you can do Incremental backups through Windows Server Backup, but my limitation using that is I cant setup multiple backups.
    Yes, you are right. Windows Server Backup feature in Windows Server 2008/2008 R2 has not this functionality (although
    ntbackup in Windows XP and Windows Server 2003 had this functionality). So, the only workaround to this limitation is through using Task Scheduler feature with wbadmin command. For more information see the following article:
    http://blogs.technet.com/b/filecab/archive/2009/04/13/customizing-windows-server-backup-schedule.aspx
    So are you saying that even though I want each backup to go to a different place on the Shared Folder that it will replace the previous backup anyways?
    No and because of this I said in my previous post that with some modifications and additions you can do the scenario. For example, you back up to a shared folder with the name of Shared1 on Mondays. You also have been configured the backup feature to back
    up data on another shared folder, named Shared2, on Wednesday. When you repeat the backup operation in Shared1, only the backed up data that resides on it will be affected, and the data on Shared2 remains intact.
    Please feel free to let us know if you have any question or concern.
    Please VOTE as HELPFUL if the post helps you and remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading
    the thread.
    Hi R.Alikhani
    Then do you know if wbadmin supports incremental backup in Windows 8? As you said the VSS issue is fixed in Win8. However, the wbadmin has less options then in windows server. I tried a bit but it seems it only supports full backup? ps, I use a network share
    - will the incremental backup works if I define a ISCCI then? My remote backup PC is also running Win8.

  • Script doesn't work in task scheduler

    I know it has already posted many times but I have already tried everything and still I can't get it to work.
    The script is a simple send email function and it works if executed from the command prompt:
    powershell.exe -f .\sendEmail.ps1 [email protected] "Test Subject" "Test Message"
    But in the task scheduler it doesn't work and no email is sent. The exit code of the task is 0xFFFD0000:
    Task Scheduler successfully completed task "\SendEmailTest" , instance "{15ff2070-ee25-4b2e-9ae1-274eda0d8c3a}" , action "powershell.exe" with return code 4294770688.
    The task is configured to run under the SYSTEM account with highest privilege, powershell ist configured with unrestricted execution policy, why it doesn't work?
    I have tried also with a simpler task to create a text file
    New-Item c:\scripts\new_file.txt -type file -force -value "This is text added to the file"
    But it doesn't work too, so it should be some other missing privilege somewhere but I couldn't find anything in internet.
    Thanks for any help

    I found another possible issue while looking at a similar problem. I was unable to execute a PowerShell script as a Task Scheduler action, even though the script ran correctly when logged into Windows as the target user and running within PowerShell.
    Task Scheduler would consistently display the 0xFFFD0000 error when I nominated the script in the task's action arguments using what I believed to be normal PowerShell quoting rules:
    -ExecutionPolicy Bypass -File 'D:\full path\to\script.ps1'
    PowerShell acquiesced and Task Scheduler fired off the task immediately and without issue when I changed the quotes I used from single to double:
    -ExecutionPolicy Bypass -File "D:\full path\to\script.ps1"
    Dropping to a command prompt and executing the full command immediately revealed the problem:
    D:\>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File 'D:\full path\to\script.ps1'Processing -File ''D:\full path\to' failed: The given path's format is not supported. Specify a valid path for the -File parameter.
    Notice the strange use of two single quotes before the path and one single quote after.
    The moral of the story: When feeding the full path of a script to PowerShell as a command line parameter,
    use double quotes!

  • Task Scheduler Won't Run WBADMIN Backup

    After several weeks of trying, the backup (wbadmin) doesn't work from the task scheduler.  When I enter the WBADMIN Start Backup command directly into a command prompt, it executes perfectly and backs up everything it's supposed to, but for some reason,
    when that EXACT SAME COMMAND is executed from the task scheduler it starts, then immediately stops.  I opened the Task Scheduler, clicked on "Task Scheduler Library" in the left pane, and looked at the backup job in the top window of the center pane. 
    The "Last Run Result" column simply showed, "(0xFFFFFFFF")".  I also clicked on the job's History Tab, which showed 7 entries at the date/time the job is set to trigger, which indicated that the task started and completed, "successfully" within the same
    second (i.e. 01:00:00), but absolutiely nothing is backed up, nor are there any entries for the trigger date on the backup drive.
    This has happened four Sundays in a row, and each time, when I subsequently execute the WBADMIN command from a command prompt, it works correctly.  Any ideas about what I'm missing and/or doing incorrectly
    Creacon

    Thanks Jeff, but unfortunately, I've already done all those things from advice in a previous thread.  The task scheduler DOES schedule the task, and my History is not disabled. But when the Task Scheduler starts, it then stops immediately with two
    log entries: 1) "Action Completed", and in the lower history window "Task Scheduler successfully completed the task ...", and 2) a log entry saying "Task Completed", and in the lower history window, "Task Scheduler successfully finished...", but NOTHING
    is backed up.  I've gone through the task scheduler settings for the task, and everything seems ok, but no dice.  Yet, I can enter the EXACT SAME wbadmin command into a command prompt, and the backup works fine.
    Here's the actual "SCHTASKS" command that I entered to schedule the job:
    SCHTASKS /Create /SC  WEEKLY /D SUN /TN CTServerWeeklyBackup /RL Highest /ST 01:00 /TR "WBADMIN START BACKUP -backupTarget:f: -allCritical  -include:C:\,D:\CAB\,D:\Downloads\,D:\Extracts\,D:\SSLCert\,D:\Temp\,U:\CAB\,U:\Shares\,U:\Temp\  >
    C:\backupLogs.txt"
    The above command executed without incident, then I immediately checked the task scheduler, and the task was there, properly scheduled.  When the trigger time/day occurred, the task simply started then immediately stopped, yet when I enter just
    the WBADMIN command into a command prompt, it executes correctly, completely and without incident.
    Creacon

  • Executing powershell script via task scheduler

    Hello,
    I am trying to execute powershell script via windows task scheduler which will forcefully delete all email in a mailbox, but I am getting the below errors
    Operational Code - 2
    Task Category - Action Completed --- Task Scheduler successfully completed task "\IL98" , instance "{2b193375-cbd2-4986-918d-3cfd4027d6b6}" , action "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" with return code 0.
    Last Run Result - 0X0
    When I am adding additional cmdlets in the script "Set-ExecutionPolicy Unrestricted", I am getting Last Run Result 0X5 rest of the error remains the same.
    Powershell version - 3.0
    Task Scheduler version - 1.0
    If I try to run the script manually via Exchange Powershell the script executes without any errors
    Thanks in Advance,
    Ankush Shah

    I figured out the problem, there wasn't any problem with the script but I had to correct inputs in windows task scheuler
    Below is the resolution:
    Under Actions:
        Program/Script --> ws\System32\WindowsPowerShell\v1.0\powershell.exe
        Add Argument --> -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto
    ; <filepath>"
    Eariler I was writing the filepath after double quote "
    Also I have selected the option "Run with Highest Privilages" to avoid
    0x5 error

  • Unable to receive an email by task scheduler on audit failure in windows server 2008 r2 security log

    Deal All,
    I am sorry in advance if i would be on wrong forum, i have created a task on Server 2008 r2 Domain controller that when an audit failure event triggered in windows security log then an email should reach on my email ID, but unfortunately, nothing happen
    on audit failure.i receive no email from task scheduler.
    kindly suggest me to resolve the issue. I have created Email task on  event ID 4771.
    Thanks.
    Zeeshan Ibrahim Network Administrator

    Hi Zeeshan,
    I have found a hotfix against the same error messages, though it applies to Windows Vista and Windows Server 2008, I am not sure if it will work on your machine.
    Please refer to this KB article below:
    Duplicate triggers are generated incorrectly in scheduled tasks in Windows Vista or in Windows Server 2008
    http://support.microsoft.com/kb/2617046
    Please feel free to let us know if this hotfix couldn’t help you fix this issue.
    Best Regards,
    Amy Wang

  • Task scheduler is showing success but not running job

    Hello, I have a relatively simple .net application that I realized when ran through the Task Scheduler of a Windows 2008 R2 server it shows in the status that i completed successfully but apparently did not run at all from looking at the log file. 
    When I just manually execute this program it runs perfectly fine.  I am using myself as the user to run this task and have full permissions. 
    I also tried a test batch file that just echos some text into a text file.  Same issue.... shows that it runs ok in task scheduler but doesnt do anything while running it manually works fine.
    Any ideas of what could be causing this?  thanks

    Hi Nehemiah,
    I ran the test batch file as below and work without issue:
    @echo This is a test> d:\test.txt
    And this is my setting:
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Task Scheduler doesn't work for restarting the server but event log says successful.

    Hi All,
         I have created a scheduler task to run every weekend to restart the Windows Server 2008 R2 Standard(64 Bit OS). The task everything has been successfully created. I check manually if it actually restarts but it doesn't but on the event
    logs of the Task Scheduler it says restarted successfully and returns status code 0. But it doesn't seem to work.
    Thanks in advance.

    Hi Prasad Venkatesan,
    Can you tell more detailed information about how do you set this scheduled task?
    To create a scheduler of restarting at specific time, please also try these steps:
    Press WinKey+R > type taskschd.msc and press Enter (it will launch Task Scheduler)
    Left click from the right pane on the Task Scheduler Library > open Action from the top menu > New Folder... > name it MyTasks
    > click OK
    Left click on the MyTasks > choose Action from menu > Create Basic Task... (it will open task wizard)
    You can enter the Name , for example "Restart", and press Next
    In Trigger section you can specify when you want to run your task, for example:
    Select Daily , and press Next
    Now you can specify the day, the hour and set to recur every day, after that press Next
    In Action section you can choose what you want to run, for example restart your system, to do this:
    choose Start a program , and press Next
    in the Program/script field type shutdown /r , and press Next
    please press Finish
    Then check if it can work.
    Best Regards,
    Anna

  • Windows Server Backup scheduled task run successfully but backup do not start (not running) on Windows Server 2012

    Hi,
    A backup job has been setup on Windows Server 2012 (Platform: Win32NT; ServicePack: ; Version: 6.2.9200.0; VersionString : Microsoft Windows NT 6.2.9200.0) via Windows Backup Software UI (Local Backup 1.0).
    It is appearing as a scheduled task "\Microsoft\Windows\Backup\Microsoft-Windows-WindowsBackup" belonging to user 'nt authority\system' in task scheduler.
    The problem is that the Backup job never start despite the scheduled task running and completing successfully (when run automatically or manually)!
    Would you be able to explain why and assist in resolving that issue?
    Here is what we know:
    When the backup is run manually via the Windows Backup Software UI, it works fine.
    When the backup is run via command line (as set in schedule task) in a cmd command prompt (as local/domain 'administrator' or as 'nt authority\system' which is possible by running command prompt via 'PsExec.exe -i -s cmd'), something like "%windir%\System32\wbadmin.exe
    start backup -templateId:{f11eb3aa-74e7-4ff4-a57b-d8d567ee3f77} -quiet", it works fine.
    If you manually run the preset scheduled task while logged in as administrator, the task run and complete successfully but the backup job does not start.
    Idem if you schedule task is run automatically at scheduled time.
    The schedule task run and complete successfully but the backup job does not start.
    It is confirmed by running the following in a command prompt as 'nt authority\system':
    schtasks /run /tn "\Microsoft\Windows\Backup\Microsoft-Windows-WindowsBackup"
    SUCCESS: Attempted to run the scheduled task "\Microsoft\Windows\Backup\Microsoft-Windows-WindowsBackup".
    Despite success result, the Backup job does not start running...
    No errors or warning appears anywhere in Event Logs (Microsoft > Windows > Backup or Task Scheduler) nor in the scheduled task History tab. The schedule task complete successfully but no Backup job is run...
    If scheduled task automatically set by Windows Backup software is duplicated (copied) and set manually it runs fine as 'administrator' and as 'nt authority\system' (subject that 'nt authority\system' is added to the 'Backup Operators' AD group).
    Here is an export of the current pre-set schedule task, is there any settings that need to be changed to make it works?
    <?xml version="1.0" encoding="UTF-16"?>
    <Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
      <RegistrationInfo>
        <Author>MYDOMAIN\SERVER1</Author>
        <SecurityDescriptor>D:AR(A;OICI;GA;;;BA)(A;OICI;GR;;;BO)</SecurityDescriptor>
      </RegistrationInfo>
      <Triggers>
        <CalendarTrigger id="Trigger 1">
          <StartBoundary>2014-07-14T21:00:00</StartBoundary>
          <Enabled>true</Enabled>
          <ScheduleByDay>
            <DaysInterval>1</DaysInterval>
          </ScheduleByDay>
        </CalendarTrigger>
      </Triggers>
      <Principals>
        <Principal id="Author">
          <UserId>S-1-5-18</UserId>
          <RunLevel>HighestAvailable</RunLevel>
        </Principal>
      </Principals>
      <Settings>
        <MultipleInstancesPolicy>Parallel</MultipleInstancesPolicy>
        <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
        <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
        <AllowHardTerminate>true</AllowHardTerminate>
        <StartWhenAvailable>true</StartWhenAvailable>
        <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
        <IdleSettings>
          <StopOnIdleEnd>false</StopOnIdleEnd>
          <RestartOnIdle>false</RestartOnIdle>
        </IdleSettings>
        <AllowStartOnDemand>true</AllowStartOnDemand>
        <Enabled>true</Enabled>
        <Hidden>false</Hidden>
        <RunOnlyIfIdle>false</RunOnlyIfIdle>
        <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
        <UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
        <WakeToRun>false</WakeToRun>
        <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
        <Priority>7</Priority>
      </Settings>
      <Actions Context="Author">
        <Exec>
          <Command>%windir%\System32\wbadmin.exe</Command>
          <Arguments>start backup -templateId:{f11eb3aa-74e7-4ff4-a57b-d8d567ee3f77} -quiet</Arguments>
        </Exec>
      </Actions>
    </Task>
    Thank you in advance for your feedback.

    Once again, the issue is not to run the backup manually from the command line but to have it run via the scheduled task setup by the Windows Backup software.
    By default, the schedule task is to be run as NT Authority\System, and when run under this account, the backup does not start (even though account is member of Backup Operators) and job can manually be run via elevated command prompt. This is not a normal
    behavior and constitute a major bug in Windows Server 2012.
    From my understanding the NT Authority\System account is a built-in account from Windows that should by default be part of the Administrators group (built-in) even though it does not explicitly appears like it in AD by default.
    This account shall have by default Administrators rights and Backup Operators rights (via the Administrators group) without being explicitly added to those groups (http://msdn.microsoft.com/en-gb/library/windows/desktop/ms684190%28v=vs.85%29.aspx). By design
    it is supposed to be the most powerful account which has unrestricted access to all local system resources. If that is not the case (as it seems) then this would constitute a major bug in Windows Server 2012 edition.
    As said previously and as you confirmed, currently by default NT Authority\System on Windows 2012 server cannot start backup manually via an elevated command prompt unless it is manually added to Backup Operators (or Administrators) group. But wouldn't that
    constitute a bug of Windows Server 2012?
    Our server has not yet been restarted since I added NT Authority\System account to the Administrators group explicitly manually so I cannot yet confirmed it would sort the issue. Indeed it is heavily in use so cannot easily be restarted. Will confirm when
    done.
    We also have an additional problem where after a while of last reboot, part of the Exchange ECP can no longer be properly loaded in the web browser due to compilation error (compilation is done via NT Authority\System account which seems to no longer have
    sufficient right to compile .NET code). What is strange is that it works at first and then stop working at some point... I am hopeful that adding NT Authority\System to the Administrators group would sort this issue as well but once again, that shall not be
    needed!!!
    Could a Windows Server 2012 update introduced some security policy changes or else that prevent NT Authority\System to have full power?

  • Opening Excel Workbook Fails when run from Scheduled Task on Windows Server 2008 Rw

    Hi,
    I have a little vbs script that instantiates the Excel.Application object and then opens a work book to perform some tasks on it. The script runs fine when run from the command line. When I attempt to run it as a scheduled task (it is supposed to update
    data that is pulled from a SQL Server at regular intervals), it fails with the following error:
    Microsoft Office Excel cannot access the file 'c:\test\SampleWorkbook.xlsm'. There are several possible reasons: .....
    The file does exist. The path reported in the error is correct. The account under which the task is running is the same account I use to run it from the command line. User Account Control is not enabled, and the task is set up to run with highest privileges.
    When I run the same script through the Task Scheduler from a Windows Server 2003 machine, it works without issue.
    I was just wondering if somebody on this forum has run into a similar issue in connection with Windows Server 2008 R2 and figured out what the magic trick is to make it work. I'm sure it is rights related, but I haven't quite figured out what which rights
    are missing.
    Thanks in advance for any advice you may have.

    This is truly killing me ... trying to get it working on Windows Server 2012 without success.
    I desperately need to automate running Excel macros in a "headless" environment, that is non-interactive, non-GUI, etc.
    I can get it to work using Excel.Application COM, either via VBScript or Powershell, successfully on many other Windows systems  in our environment - Windows Server 2008 R2, Windows 7 (32-bit), etc.,  -BUT-
    The two servers we built out for running our automation process are Windows Server 2012 (SE) - and it just refuses to run on the 2012 servers - it gives the messages below from VBScript and PowerShell, respectively- 
    I have tried uninstalling and re-installing several different versions of Microsoft Excel (2007 Standard, 2010 Standard, 2010 Professional Plus, 32-bit vs. 64-bit, etc.), but it makes no difference.
    Would be extremely grateful if any one out there has had any success in running Excel automation on Server 2012 in a non-interactive environment that they could share.
    ( I have tried adding the "%windir%\syswow64\config\systemprofile\desktop"
    folder, which did fix the issue for me when testing on Windows Server 2008 R2, but sadly did not resolve it on Windows Server 2012 )
    [VBScript error msg]
    Z:\TestExcelMacro.vbs(35, 1) Microsoft Office Excel: Microsoft Office Excel cannot
    access the file 'Z:\TestExcelMacro.xlsm'. There are several possible reasons:
    • The file name or path does not exist.
    • The file is being used by another program.
    • The workbook you are trying to save has the same name as a currently open work
    [Powershell error msg]
    Exception calling "Add" with "0" argument(s): "Microsoft Office Excel cannot open or save any more documents because th
    ere is not enough available memory or disk space.
     To make more memory available, close workbooks or programs you no longer need.
     To free disk space, delete files you no longer need from the disk you are saving to."
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : ComMethodTargetInvocation
    You cannot call a method on a null-valued expression.
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull

  • Script Task Builds Successfully But Still Has Compile Error (SQL 2012)

    This is repost in a way but the problem has not gone away and I really need to find a solution.
    I have some script from SSIS 2008 that uses the ReportExecution2005
    web service to execute SSRS reports and save the results to Excel. There were some initial problems with confusion between Web Service Reference (legacy?) and Service Reference (WCF) but I think that I have that sorted out
    now.
    The remaining problem is that, while the VB script (which I have pasted in from a working SSIS 2008 Script Task) builds/complies without error, I get a compile error when I close the Script Task and it has the dreaded "Red X" in the Control
    Flow. If I attempt to run the package I get a message box saying that there is a compile error.
    How can I identify the problem and fix the error? The script itself has no errors in SSIS 2008.
    R Campbell

    This is the code by the way (see below) as pasted into the Main sub.
    I have added
    http://localhost/reportserver/reportexecution2005.asmx as a Web Service
    Reference (under the  "Advanced" button) not just a Service Reference (WCF).
    I can build the code without error but I get an error, saying that there is compile error, when I close the Script Task.
    ReportExecutionService definitely shows up in Object Explorer, not the
    WCF "equivalent" of ReportExecutionServiceSoapClient.
    I have always had the impression, that when you close a Script Task, a compiler kicks in to auto-generate some internal script. Could it be (as seems likely) that this compiler is picking up errors that "Build" doesn't (when the script is open)?
    I think that there was once an explicit Compile rather than just Build option in the Script editing environment but I can't find it in SQL 2012 Database Tools (nee BIDS).
    Dim objRSExec As New localhost.ReportExecutionService
    Dim objParam0 As New localhost.ParameterValue
    Dim objParam1 As New localhost.ParameterValue
    Dim objParam2 As New localhost.ParameterValu
    Dim objParam3 As New localhost.ParameterValue
    Dim objParam4 As New localhost.ParameterValue
    Dim objParam5 As New localhost.ParameterValue
    Dim objParam6 As New localhost.ParameterValue
    Dim objParams() As localhost.ParameterValue
    Dim objResult() As Byte
    Dim objStream As FileStream
    Dim FileType As String
    Dim FileExtension As String
    Dim FilePath As String
    Dim NumberOfParameters As Integer
    Dim ReportName As String
    Dim TaskSuccess As Boolean = True
    FileType = Dts.Variables("FileType").Value.ToString()
    FileExtension = Dts.Variables("FileExtension").Value.ToString()
    FilePath = Dts.Variables("FilePathNameExt").Value.ToString()
    ReportName = Dts.Variables("ReportPathName").Value.ToString()
    NumberOfParameters = CInt(Dts.Variables("NumberOfParameters").Value) - 1
    ReDim objParams(NumberOfParameters)
    If NumberOfParameters >= 0 Then
    objParam0.Name = Dts.Variables("P0Name").Value.ToString()
    objParam0.Value = Dts.Variables("P0Value").Value.ToString()
    objParams(0) = objParam0
    End If
    If NumberOfParameters >= 1 Then
    objParam1.Name = Dts.Variables("P1Name").Value.ToString()
    objParam1.Value = Dts.Variables("P1Value").Value.ToString()
    objParams(1) = objParam1
    End If
    If NumberOfParameters >= 2 Then
    objParam2.Name = Dts.Variables("P2Name").Value.ToString()
    objParam2.Value = Dts.Variables("P2Value").Value.ToString()
    objParams(2) = objParam2
    End If
    If NumberOfParameters >= 3 Then
    objParam3.Name = Dts.Variables("P3Name").Value.ToString()
    objParam3.Value = Dts.Variables("P3Value").Value.ToString()
    objParams(3) = objParam3
    End If
    If NumberOfParameters >= 4 Then
    objParam4.Name = Dts.Variables("P4Name").Value.ToString()
    objParam4.Value = Dts.Variables("P4Value").Value.ToString()
    objParams(4) = objParam4
    End If
    If NumberOfParameters >= 5 Then
    objParam5.Name = Dts.Variables("P5Name").Value.ToString()
    objParam5.Value = Dts.Variables("P5Value").Value.ToString()
    objParams(5) = objParam5
    End If
    If NumberOfParameters >= 6 Then
    objParam6.Name = Dts.Variables("P6Name").Value.ToString()
    objParam6.Value = Dts.Variables("P6Value").Value.ToString()
    objParams(6) = objParam6
    End If
    Try
    With objRSExec
    .Credentials = System.Net.CredentialCache.DefaultNetworkCredentials
    .Url = "http://localhost/reportserver/reportexecution2005.asmx"
    .LoadReport(ReportName, Nothing)
    .SetExecutionParameters(objParams, "en-us")
    objResult = .Render(FileType, Nothing, FileExtension, Nothing, Nothing, Nothing, Nothing)
    End With
    objStream = File.Create(FilePath, objResult.Length)
    With objStream
    .Write(objResult, 0, objResult.Length)
    .Close()
    End With
    Catch e As Exception
    Dts.Log("ERROR - RSExec - " & e.Message.ToString(), 100, Nothing)
    TaskSuccess = False
    End Try
    If TaskSuccess Then
    Dts.TaskResult = ScriptResults.Success
    Else
    Dts.TaskResult = ScriptResults.Failure
    End If
    R Campbell

  • Windows Server 2008 sp2 Task Scheduler missing next run time after restart

    Hi,
    I have the issue that there does not appear to be a fix for with a server 2008 sp2 (NOT R2) where after a restart all tasks are missing the next run time so I need to edit each task to add this time back in. I have tried  the hotfix in KB 950035
    but this when you run it is only for Vista and cannot be installed despite saying it's also for Server 2008.
    For some reason also this is Task Scheduler version 1 not 2 which I thought came with windows since Vista so SP2 should have it.
    Anyone got any ideas?
    Thanks,

    Hi Evans,
    Would you please let us know current situation of this issue?
    As Dave mentioned, Windows Server 2008 Service Pack 2 include all the previously released updates for Windows
    Server 2008.
    Based on your description, I understand that all scheduled tasks still miss the next run time on your Windows
    Server SP2 when the server restart. If anything I misunderstand, please don’t hesitate to let me know.
    On current situation, please open Properties of one problematic scheduled task, navigate to History tab, then
    check if find some relevant events or errors. Those may help us to go further analyze.
    If any update, please feel free to let us know.
    Hope this helps.
    Best regards,
    Justin Gu
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Server 2008 - Task Scheduler - Send an E-mail fails

    When ever we set an action to send an E-mail in the Server 2008 Task Scheduler GUI, we get a "Task failed" result of
    "Cannot modify or delete an object that was not added using the COM+ Admin SDK (0x8004020D)  once the task gets to that step.
    I have tried creating tasks that do nothing but try and send an email using the new functionality of the Task Manager and it fails with the exact same error, So I have narrowed it down to the email action being the culprit.  As soon as I remove it from the other tasks, everything works as planned.
    Is there a fix for this?  Is there a permission I need to set somewhere?  It seems that some people have tried running the task as the "Network Service" and it works, but I have had no such luck yet.
     

     
    Hi,
    If a task attempts to send an e-mail, but the e-mail doesn't get sent correctly, first make sure that the settings for the e-mail action on the task are set correctly. The e-mail action must have a valid value for the SMTP server, To, and From settings. For more information about these settings, please refer to the following article:
    Actions
    http://technet.microsoft.com/en-us/library/cc722129.aspx
    Make sure the SMTP server that sends the e-mail is setup correctly. E-mail is sent using NTLM authentication for Windows SMTP servers, which means that the security credentials used for running the task must also have privileges on the SMTP server to send e-mail. If the SMTP server is a non-Windows based server, then the e-mail will be sent if the server allows anonymous access.
    For information about setting up the SMTP server, please see the following article:
    SMTP Server Setup
    http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/e4cf06f5-9a36-474b-ba78-3f287a2b88f2.mspx?mfr=true
    And for information about managing SMTP server settings, please see the following article:
    SMTP Administration
    http://technet.microsoft.com/en-us/library/cc758258.aspx
    Hope it helps.
    Tim Quan - MSFT

Maybe you are looking for

  • Inserting pictures / objects in Keynote

    When inserting A jpeg file into a Keynote slide, is there a way of blending the backgroung of the jpeg to match the theme. For example with say a scanned company logo, the jpeg file would contain a white background which would appear as a white box w

  • Can Xcelsius 2008 Engage coexist on the same machine as SAP Crystal Dashboard Design?

    I still have the requirement to maintain dashboards created with Xcelsius 2008 SP5. Will the install of SAP Crystal Dashboard Design: Departmental overwrite or disable the ability to run Xcelsius 2008 on the same machine?

  • Itunes 10.4 album art missing

    I downloaded 10.4 now i can't see the album art in the preview, is this a software problem.

  • Macbook pro will not switch on

    The Battery level was full the macbook pro has no life what so ever, will not switch on

  • Error in File

    Hi everyone, The following code create an execution time error and I can not find the solution for this. If you help me, I will be happy. import java.io.*; class Files {      // properties      static int first = 0;      // constructor      public Fi