Windows Task Scheduler

We have script with batch file and its not running on windows 2008 servers..
the share directory contains sharepoint sites as share drive..
I have checked the options
1.Run with highest privilleges
2. Do not store password
Can someone help me to get this resolved?

if you run the batch file via command prompt, does it work as expected?
or any errors on the task scheduler window?
have you set the option to run only when user is logged on?
if it set like that and the user logs off, the task scheduled will not run.
check out link below for some ideas:
Set Task Scheduler
Every second counts..make use of it. Disclaimer: This posting is provided AS IS with no warranties or guarantees and confers no rights.
IT Stuff Quick Bytes

Similar Messages

  • Windows task scheduler to run batch file running a java program

    I have created a batch file that runs my SendEmail program. The batch file is in the same directory as the java program. The only line in the batch file is
    java SendEmail
    This works fine from the command prompt but from the windows task scheduler it fails to function. Any help on how I can overcome this problem will be greatly appreciated.
    THanks

    Looks okay. The classpath is set, too, I guess? Btw, try running javaw instead of java. I may err, but I think it can show a console, so you can watch any error messages.

  • Windows Task Scheduler executing old triggers even after recreating the task

    I had this task working perfectly until I changed the schedule. After I changed the scheduled time 5 minutes earlier, I noticed that in the history, it still triggers the old schedule. I tried restarting the server, deleting the task and recreating it even
    without a trigger and it's still executing the task with the old trigger. The attached screenshot shows that the task doesn't have a trigger but as you can see in the history it's still trying to execute the task. How does the Windows Task Scheduler work?
    Is there a file or database that I can purge the old task?
    I also tried applying this hotfix but it didn't seem to fix the issue: 
    http://support.microsoft.com/kb/2461249
    NOTE: This is Windows 2008 R2 and the Error message in the history is: Task Scheduler failed to start "<the
    name of my task>" task for user "<the
    user>". Additional Data: Error Value: 2147750689.

    Since batch job can be run manually without error, cmd.exe is not the problem.
    I researched and found that the problem may be due to exhausted desktop heap and the solution is to increase the value.
    Please try this step:
    1. restart the server first and test again (a simple solution that may work)
    2. if the first attempt fail, take a full backup first and attempt to increase desktop heap
         http://www.symantec.com/business/support/index?page=content&id=TECH48099
    Yes THAT WAS THE SOLUTION FOR THE ISSUE. !!
    Now its working perfect!!
    Why now its working and not before? Because after made the changes to the registry,
    RESTART IS NECESSARY to apply the changes and I have done it yesterday night (this server is working 24x7, so its hard to find a moment to restart it). 
    Thanks for all to help me with this issue!!! I really,really ,really ,really  apreciate !!! 
    THANKS !!!!!

  • RUNNING PHP SCRIPT WITH ZEND FRMWRK IN WINDOWS TASK SCHEDULER

    I have a PHP script which includes the Zend framework Mail.php for sending mails.
    I am running a WAMP server and i used DW to create it.
    I want to run my script in every 5 mins, How i can schedule it in Windows task scheduler.
    I tried running a bat which contains the php.exe path and arguments as php file but it gives an error that zend/mail.php not found.
    Please help its really urgent.

    Thanks for your response.
    bat file has:
    path of the php.exe -f path of php file.
    But when it runs it gives an error that the zend framework file not found.
    I have a seperate PHP includes folder under which zend FW is stored.
    That folder is marked in includes_paths in php.ini.

  • Error when using Windows Task Scheduler in C#

    I am using Windows Task Scheduler in my Visual C# application. I add the reference to C:\Windows\SysWOW64\taskschd.dll (on a 64-bit system), and Visual Studio creates a COM wrapper Interop.TaskScheduler.dll. Ths works fine on Windows 7. However, when
    I run on Windows 8.1, I get the following error:
    Unable to cast COM object of type 'System.__ComObject' to interface type 'TaskScheduler.IExecAction'.
    This operation failed because the QueryInterface call on the COM component for the interface with IID
    '{4C3D624D-FD6B-49A3-B9B7-09CB3CD3F047}' failed due to the following error:
    No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
    I noticed that on Windows 7, the above GUID exists in the registry under HKEY_CLASSES_ROOT\Interface, with the value "IExecAction". But on Windows 8.1, there is no such GUID, and no key with value "IExecAction". I use IExecAction
    in my code.
    When I develop on Windows 8.1, the program compiles, but at runtime I get the above error.

    Hello tomszms,
    Here is a blog related to this issue and the troubleshoot steps of his error is very useful for your case, so please check for it:
    http://blogs.msdn.com/b/smondal/archive/2012/10/02/unable-to-cast-com-object-of-type-system-comobject-to-interface-type-microsoft-visualstudio-ole-interop-iserviceprovider.aspx
    Please try use the same way to track the logs and then try use the regsvr32
    on your Win 8 machine to re-register that dll and see the result.
    Best regards,
    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • VBS objshell.AppActivate doesn't work with Windows Task Scheduler

    Hi all,
    This script do the following : 
    Open Adobe Flash media Live Encoder with an encoding profile
    Activate the Adobe Flash... Window
    Send enter key to start encoding
    Set objShell = WScript.CreateObject( "WScript.Shell" )
    objShell.Run """C:\Program Files (x86)\Adobe\Flash Media Live Encoder 3.2\FlashMediaLiveEncoder.exe"" /p ""C:\Users\process\AppData\Roaming\Adobe\Flash Media Live Encoder 3.2\profile.xml"""
    'Loading time
    WScript.Sleep 5000
    objshell.AppActivate ("Adobe Flash Media Live Encoder 3.2")
    WScript.Sleep 5000
    objShell.SendKeys "{ENTER}" 'start encoding
    This script perfectly works manually, but the objshell.appactivate command doesn't work when i run it with the windows task Scheduler.
    Any ideas ? Thx

    Hi to all! I have found workaround for this issue - I wrote vbs, made run it via bat file, and converted the bat file to exe
    vbs
    Set oShell = CreateObject("WScript.Shell")
    If oShell.AppActivate ("Connecting error to Bee") Then
    WScript.Sleep 2000
    oShell.SendKeys "%{F4}"
    End If
    bat
    start C:\Users\User\Desktop\close.vbs
    bat to exe
    Advanced BAT to EXE Converter v2.83
    I know it's some weird solution but it is working with Win Task Scheduler correctly. Try it ;)
    In some cases you need to mark checkbox "run this program as an administrator" and (or not) disable UAC.

  • Issues with Windows TasK Scheduler

    Hi!
    I'm having two issues recently with Windows Task Scheduler, and I'm wondering if anyone else has experienced this and know of a resolution. We are on Windows Vista.
    Error value 2147750687 - The task we are using has been running successfully since day one, all of a sudden, two concurrent jobs got triggered the other day, thus one of them failed and gave us this error. Why would the scheduler kick off two jobs start at the same time? How can that happen? The settings are "run with the highest privileges" and run whether user is logged on or not".
    Error value 2147549186 - On this one, the task was running as scheduled, no errors in the log, then all of the sudden, after 10 minutes into the job, it re-started “due to a failure”. The settings are set to restart after 5 minutes, 3 attempts, but since it was running, and our logs do not identify any issues, what could have caused the scheduler to think there was an error?
    Joe

    Hi LordTim,
    >>However, I cannot get Access to load<<
    How did you load the Access? Did you use Access object to automate the Access applicaiton?
    If I understood correctly, did Access load successfully when you in a normal script?
    If yes, I think the issue may relative to the Task Scheduler. I suggest that you get more effective response from
    Windows Community forum about Task Scheduler issue.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Open local windows task scheduler programmatically from a button

    What is the code to call windows task scheduler in visual basic 2013? I am not scheduling a task during this process, instead the requirement is to just attach code in a button that opens user's "Windows Task Scheduler" onclick. It would be more
    like the programmatic equivalent of typing "taskschd.msc" on the Run dialog box. Users OS are Windows 7 and 8. I appreciate your help.

    System.Diagnostics.Process.Start("Schtasks.exe"); opened a console screen in the background, ran several lines and
    quit. What I need is something similar that will simply open the Task Scheduler as shown on the attached. Thanks.

  • Windows Task Scheduler does not execute .vbs script as exptected while using CScript.exe

    We have a .vbs script that reads a source text file, looks for errors, performs a find/replace and then writes a cleaned version of the file to a destination folder.
    When executing the script by manually double clicking on the .vbs file, the script works flawlessly.  But when executing via Windows Task Scheduler using Cscript.exe, it creates an empty, zero byte, text file.  Task Scheduler is set to run
    "C:\Windows\System32\cscript.exe" with the Add arguments (optional): C:\Scripts\myscript.vbs.
    Does anyone know of a way to make it work using the Windows Task Scheduler?
    Part of the Script:
    Sub CheckFilesIntegrity()
    Dim cleanedfile,strLine,outputStr, tempstr, tmpChar, changeTo, companycode, storestring
    Dim ObjFileSys, objFile,objCleanFile
    charArray = Array("-","?", "/", "\", ":", "*", """", "<", ">", ",", "&", "#", "~", "%", "{",
    "}", "+", "_", ".", "a", "e", "o", "s", "h","i","E", "O","P", "S", "p", "=")
     Set ObjFileSys   = CreateObject("Scripting.FileSystemObject")
     Set objCleanFile = CreateObject("Scripting.FileSystemObject")
     Set objFile = ObjFileSys.OpenTextFile(file.name, ForReading, True)
     textfilename = destinationpath & objfilesys.GetBaseName(file) & ".txt"
     Set cleanedfile = objCleanFile.OpenTextFile(textfilename, ForWriting, True)
     ObjLog.writeline "File containing cleaned up data: " & textfilename
     Do while not objfile.AtEndOfStream
         strLine = objfile.ReadLine()
         tempstr = strLine
         If (Left(UCase(tempStr),8) <> "HPAYMENT") Then
          'fix pay now data entry whre record does not have a company code
          If Mid(tempstr, 18,3) = "000" Then
           companycode = Mid(tempstr,32,3)
           storestring = Left(tempstr,17)
           tempstr =Replace(tempstr,"000",companycode,18,1,1)
           tempstr = storestring & tempstr
           storestring = Left(tempstr,31)
           tempstr= Replace(tempstr,companycode,"000",32,1,1)
           tempstr = storestring & tempstr
          End If
          'remove invalid characters and replace them with zero (filler)
       For Each tmpChar in charArray
        Select Case tmpChar
         Case "-","?", "/", "\", ":", "*", """", "<", ">", ",", "&", "#", "~", "%",
    "{", "}", "+", "_", ".", "a", "e", "o", "s", "h","i","E", "O","P", "S", "p", "="
         changeTo = "0"
         outputStr = replace( tempstr, tmpChar, changeTo,1,-1,1 )
        End Select
        tempstr=outputstr
       Next
      Else
       outputStr = tempstr 
      End If
        strLine = outputStr
      cleanedfile.writeline(strLine)
     Loop
     cleanedfile.Close
     Set cleanedfile = Nothing
     Set ObjFileSys = Nothing
     Set objFile = Nothing
     ObjLog.writeline " Completed processing of file: " & textfilename
    End Sub

    So we ended up getting it to work by replicating the double click function.  Meaning that we created a Batch file that calls the .vbs script, then had Windows Task Scheduler run the Batch file.  In that way all necessary permissions were passed
    through from one environment to another, which was failing when we called the .vbs script using CScript.

  • DirectAccess multisite on Server 2012 R2: 'The remote access configuration task (raconfigtask) in Windows Task Scheduler cannot be disabled"

    Dear all,
    I'm an experiencing an issue when configuring 2012 R2 DirectAccess multisite.
    The initial configuration of the first site in a multisite setup works fine, however when i try to add ANY other server on another site, i see the below screenshot, the full text of which is: "The remote access configuration task (raconfigtask) in Windows
    Task Scheduler cannot be disabled" while the entry point is added.
    THere are no logged events on the remote server, but on the controlling server i see this in the event log:
    Log Name:      Microsoft-Windows-TaskScheduler/Operational
    Source:        Microsoft-Windows-TaskScheduler
    Date:          10/15/2014 12:55:58 AM
    Event ID:      140
    Task Category: Task registration updated
    Level:         Information
    Keywords:      
    User:          SYSTEM
    Computer:      WWCLORAS01.apco.net
    Description:
    User "S-1-5-18"  updated Task Scheduler task "\Microsoft\Windows\RemoteAccess\RaConfigTask"
    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>140</EventID>
        <Version>0</Version>
        <Level>4</Level>
        <Task>140</Task>
        <Opcode>0</Opcode>
        <Keywords>0x8000000000000000</Keywords>
        <TimeCreated SystemTime="2014-10-15T07:55:58.432317300Z" />
        <EventRecordID>1738</EventRecordID>
        <Correlation ActivityID="{D4236B4E-E841-0003-E5BA-23D441E8CF01}" />
        <Execution ProcessID="840" ThreadID="3852" />
        <Channel>Microsoft-Windows-TaskScheduler/Operational</Channel>
        <Computer>WWCLORAS01.apco.net</Computer>
        <Security UserID="S-1-5-18" />
      </System>
      <EventData Name="TaskUpdated">
        <Data Name="TaskName">\Microsoft\Windows\RemoteAccess\RaConfigTask</Data>
        <Data Name="UserName">S-1-5-18</Data>
      </EventData>
    </Event>Log Name:      Microsoft-Windows-TaskScheduler/Operational
    Source:        Microsoft-Windows-TaskScheduler
    Date:          10/15/2014 12:55:58 AM
    Event ID:      140
    Task Category: Task registration updated
    Level:         Information
    Keywords:      
    User:          SYSTEM
    Computer:      WWCLORAS01.apco.net
    Description:
    User "S-1-5-18"  updated Task Scheduler task "\Microsoft\Windows\RemoteAccess\RaConfigTask"
    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>140</EventID>
        <Version>0</Version>
        <Level>4</Level>
        <Task>140</Task>
        <Opcode>0</Opcode>
        <Keywords>0x8000000000000000</Keywords>
        <TimeCreated SystemTime="2014-10-15T07:55:58.432317300Z" />
        <EventRecordID>1738</EventRecordID>
        <Correlation ActivityID="{D4236B4E-E841-0003-E5BA-23D441E8CF01}" />
        <Execution ProcessID="840" ThreadID="3852" />
        <Channel>Microsoft-Windows-TaskScheduler/Operational</Channel>
        <Computer>WWCLORAS01.apco.net</Computer>
        <Security UserID="S-1-5-18" />
      </System>
      <EventData Name="TaskUpdated">
        <Data Name="TaskName">\Microsoft\Windows\RemoteAccess\RaConfigTask</Data>
        <Data Name="UserName">S-1-5-18</Data>
      </EventData>
    </Event>
    And this in the taskscheduler:
    Log Name:      Microsoft-Windows-TaskScheduler/Operational
    Source:        Microsoft-Windows-TaskScheduler
    Date:          10/15/2014 12:55:58 AM
    Event ID:      140
    Task Category: Task registration updated
    Level:         Information
    Keywords:      
    User:          SYSTEM
    Computer:      WWCLORAS01.apco.net
    Description:
    User "S-1-5-18"  updated Task Scheduler task "\Microsoft\Windows\RemoteAccess\RaConfigTask"
    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>140</EventID>
        <Version>0</Version>
        <Level>4</Level>
        <Task>140</Task>
        <Opcode>0</Opcode>
        <Keywords>0x8000000000000000</Keywords>
        <TimeCreated SystemTime="2014-10-15T07:55:58.432317300Z" />
        <EventRecordID>1738</EventRecordID>
        <Correlation ActivityID="{D4236B4E-E841-0003-E5BA-23D441E8CF01}" />
        <Execution ProcessID="840" ThreadID="3852" />
        <Channel>Microsoft-Windows-TaskScheduler/Operational</Channel>
        <Computer>WWCLORAS01.apco.net</Computer>
        <Security UserID="S-1-5-18" />
      </System>
      <EventData Name="TaskUpdated">
        <Data Name="TaskName">\Microsoft\Windows\RemoteAccess\RaConfigTask</Data>
        <Data Name="UserName">S-1-5-18</Data>
      </EventData>
    </Event>
    Any ideas what might be causing this? All servers are in the same domain, firewalls don't seem to be dropping anything, SCCM client is installed, but thats it.
    Appreciate any feedback.
    Jim

    Dear all,
    I'm an experiencing an issue when configuring 2012 R2 DirectAccess multisite.
    The initial configuration of the first site in a multisite setup works fine, however when i try to add ANY other server on another site, i see the below screenshot, the full text of which is: "The remote access configuration task (raconfigtask) in Windows
    Task Scheduler cannot be disabled" while the entry point is added.
    THere are no logged events on the remote server, but on the controlling server i see this in the event log:
    Log Name:      Microsoft-Windows-TaskScheduler/Operational
    Source:        Microsoft-Windows-TaskScheduler
    Date:          10/15/2014 12:55:58 AM
    Event ID:      140
    Task Category: Task registration updated
    Level:         Information
    Keywords:      
    User:          SYSTEM
    Computer:      WWCLORAS01.apco.net
    Description:
    User "S-1-5-18"  updated Task Scheduler task "\Microsoft\Windows\RemoteAccess\RaConfigTask"
    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>140</EventID>
        <Version>0</Version>
        <Level>4</Level>
        <Task>140</Task>
        <Opcode>0</Opcode>
        <Keywords>0x8000000000000000</Keywords>
        <TimeCreated SystemTime="2014-10-15T07:55:58.432317300Z" />
        <EventRecordID>1738</EventRecordID>
        <Correlation ActivityID="{D4236B4E-E841-0003-E5BA-23D441E8CF01}" />
        <Execution ProcessID="840" ThreadID="3852" />
        <Channel>Microsoft-Windows-TaskScheduler/Operational</Channel>
        <Computer>WWCLORAS01.apco.net</Computer>
        <Security UserID="S-1-5-18" />
      </System>
      <EventData Name="TaskUpdated">
        <Data Name="TaskName">\Microsoft\Windows\RemoteAccess\RaConfigTask</Data>
        <Data Name="UserName">S-1-5-18</Data>
      </EventData>
    </Event>Log Name:      Microsoft-Windows-TaskScheduler/Operational
    Source:        Microsoft-Windows-TaskScheduler
    Date:          10/15/2014 12:55:58 AM
    Event ID:      140
    Task Category: Task registration updated
    Level:         Information
    Keywords:      
    User:          SYSTEM
    Computer:      WWCLORAS01.apco.net
    Description:
    User "S-1-5-18"  updated Task Scheduler task "\Microsoft\Windows\RemoteAccess\RaConfigTask"
    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>140</EventID>
        <Version>0</Version>
        <Level>4</Level>
        <Task>140</Task>
        <Opcode>0</Opcode>
        <Keywords>0x8000000000000000</Keywords>
        <TimeCreated SystemTime="2014-10-15T07:55:58.432317300Z" />
        <EventRecordID>1738</EventRecordID>
        <Correlation ActivityID="{D4236B4E-E841-0003-E5BA-23D441E8CF01}" />
        <Execution ProcessID="840" ThreadID="3852" />
        <Channel>Microsoft-Windows-TaskScheduler/Operational</Channel>
        <Computer>WWCLORAS01.apco.net</Computer>
        <Security UserID="S-1-5-18" />
      </System>
      <EventData Name="TaskUpdated">
        <Data Name="TaskName">\Microsoft\Windows\RemoteAccess\RaConfigTask</Data>
        <Data Name="UserName">S-1-5-18</Data>
      </EventData>
    </Event>
    And this in the taskscheduler:
    Log Name:      Microsoft-Windows-TaskScheduler/Operational
    Source:        Microsoft-Windows-TaskScheduler
    Date:          10/15/2014 12:55:58 AM
    Event ID:      140
    Task Category: Task registration updated
    Level:         Information
    Keywords:      
    User:          SYSTEM
    Computer:      WWCLORAS01.apco.net
    Description:
    User "S-1-5-18"  updated Task Scheduler task "\Microsoft\Windows\RemoteAccess\RaConfigTask"
    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>140</EventID>
        <Version>0</Version>
        <Level>4</Level>
        <Task>140</Task>
        <Opcode>0</Opcode>
        <Keywords>0x8000000000000000</Keywords>
        <TimeCreated SystemTime="2014-10-15T07:55:58.432317300Z" />
        <EventRecordID>1738</EventRecordID>
        <Correlation ActivityID="{D4236B4E-E841-0003-E5BA-23D441E8CF01}" />
        <Execution ProcessID="840" ThreadID="3852" />
        <Channel>Microsoft-Windows-TaskScheduler/Operational</Channel>
        <Computer>WWCLORAS01.apco.net</Computer>
        <Security UserID="S-1-5-18" />
      </System>
      <EventData Name="TaskUpdated">
        <Data Name="TaskName">\Microsoft\Windows\RemoteAccess\RaConfigTask</Data>
        <Data Name="UserName">S-1-5-18</Data>
      </EventData>
    </Event>
    Any ideas what might be causing this? All servers are in the same domain, firewalls don't seem to be dropping anything, SCCM client is installed, but thats it.
    Appreciate any feedback.
    Jim

  • Windows task scheduler not running

    Hi All!
    (First of all, sorry for my poor english!)
    I have a couple of windows servers 2008 R2 Enterprise SP1 on my company and one of them doesnt work like it should and was instaled from zero last week.
    I create a bat file to do some stuff and because it dosnt work, for test porpouses i made a bat file realy simple, that wirtes file
    Here is the bat file code:
    echo "text_example" > C:\scripts\works.txt
    my user has write permisions and the task is configured to run with my user.
    If i run my bat manualy works fine.
    If this job is set to the task scheduler  "run only if user is loged" also works fine
    BUT when i set the task to run wheter "the user is logued or not" and I log off and return after the job was triggered, i found that the last run date is the one i set but the last run result is (0xc000142) and the task ovbiusly didnt work. 
    Im figthing with this problem las 4 days and i cant find why is this appening (its trange that in the other servers in the same group works fine)
    Here is the task code:
    <?xml version="1.0" encoding="UTF-16"?>
    <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
      <RegistrationInfo>
        <Date>2014-11-17T14:07:58.9325949</Date>
        <Author>GROUP\rrepetto</Author>
      </RegistrationInfo>
      <Triggers>
        <CalendarTrigger>
          <StartBoundary>2014-11-17T17:46:00</StartBoundary>
          <Enabled>true</Enabled>
          <ScheduleByDay>
            <DaysInterval>1</DaysInterval>
          </ScheduleByDay>
        </CalendarTrigger>
      </Triggers>
      <Principals>
        <Principal id="Author">
          <UserId>GROUP\rrepetto</UserId>
          <LogonType>Password</LogonType>
          <RunLevel>LeastPrivilege</RunLevel>
        </Principal>
      </Principals>
      <Settings>
        <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
        <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
        <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
        <AllowHardTerminate>true</AllowHardTerminate>
        <StartWhenAvailable>false</StartWhenAvailable>
        <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
        <IdleSettings>
          <StopOnIdleEnd>true</StopOnIdleEnd>
          <RestartOnIdle>false</RestartOnIdle>
        </IdleSettings>
        <AllowStartOnDemand>true</AllowStartOnDemand>
        <Enabled>true</Enabled>
        <Hidden>false</Hidden>
        <RunOnlyIfIdle>false</RunOnlyIfIdle>
        <WakeToRun>false</WakeToRun>
        <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
        <Priority>7</Priority>
      </Settings>
      <Actions Context="Author">
        <Exec>
          <Command>C:\scripts\test.bat</Command>
        </Exec>
      </Actions>
    </Task>
    Any help will be greatly appreciated !
    Thanks In advance!
    Ramiro

    Since batch job can be run manually without error, cmd.exe is not the problem.
    I researched and found that the problem may be due to exhausted desktop heap and the solution is to increase the value.
    Please try this step:
    1. restart the server first and test again (a simple solution that may work)
    2. if the first attempt fail, take a full backup first and attempt to increase desktop heap
         http://www.symantec.com/business/support/index?page=content&id=TECH48099
    Yes THAT WAS THE SOLUTION FOR THE ISSUE. !!
    Now its working perfect!!
    Why now its working and not before? Because after made the changes to the registry,
    RESTART IS NECESSARY to apply the changes and I have done it yesterday night (this server is working 24x7, so its hard to find a moment to restart it). 
    Thanks for all to help me with this issue!!! I really,really ,really ,really  apreciate !!! 
    THANKS !!!!!

  • JFileChooser() not working with windows task scheduler

    I have a program that would send emails with attachments to users. The program should be ran according to the scheduled time, and because of that I use task scheduler to do it for me. I did all necessary steps to make this happen. (create .bat file to activate/run the jar file then task scheduler will trigger the .bat file if it hits the stated schedule.) The problem right now is that when the program is ran or is triggered by task scheduler, it gives off this error:
    java.lang.NullPointerException
    at sun.awt.shell.Win32ShellFolder2$1.call(Unknown Source)
    at sun.awt.shell.Win32ShellFolder2$1.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at sun.awt.shell.Win32ShellFolderManager2$ComInvoker$3.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)I tried running it manually by using the .bat file and it works fine with no errors or whatsoever. I'm suspecting it has something to do with jFileChooser() because It wont retrieve the attachments in the default directory, but I'm not sure, there might be other causes. Here's the function that retrieves the attachments in the default directory:
    public String getMyDocument(String filename)
         JFileChooser fr = new JFileChooser();
         FileSystemView fw = fr.getFileSystemView();
         return fw.getDefaultDirectory().toString()+"\\"+filename+".xls";
    }PS.
    All required attachments are present in the default directory, no misspelled words or misplaced characters. I also did some research but so far i haven't found any solutions yet.

    gimbal2 wrote:
    sabre150 wrote:{quoteStrange code anyway to use a filechooser to get a directory, especially when apparently no actual GUI is created. My immediate thought when I saw the code. I'm not even sure there is a default directory if the component is not realized but I have never checked. I would like to suggest to the OP that he uses the "user.home" directory but again I have never checked where that points when used with the task scheduler. It could be that it is not defined and that file chooser uses this as the default if not explicitly set. This is why I suggest that the OP writes out the value.

  • PS Scheduling via Windows Task Scheduler

    Hi All,
    I have been pulling my hair out trying to schedule my APIWSUSCleanup.ps1 file from this thread (http://social.technet.microsoft.com/Forums/en-US/eee88f8a-57de-46db-8d60-efb0e72d57b9/running-5-commands-using-array-elements-and-waiting-between?forum=winserverpowershell)
    to run as a scheduled task. Running interactively from a remote PS session the script file runs fine and produces the log file that it should.
    I have tried so many different combinations (including nonsensical just to be certain and rule them out) that I'm sure I have started going around in circles, there doesn't seem to be a definitive answer out there so hopefully someone on here can see what
    I'm doing wrong for my situation.
    I cldn't find any references for WSUS Management Shell cmdlets so I'm assuming that there isn't one that needs to be passed for the script to work like Exchange requires?
    Environment: Server 2012 WSUS Core install being administered with Server Manager from a GUI Server 2012 install. Scheduled task being added via Computer Management. I have setup the script
    execution using "set-executionpolicy remotesigned" from a Remote Powershell session, assuming that this sets it for x64 and x86? I did see one comment stating that is doesn't.
    Task: Run as SYSTEM (have tried local admin account), Run whether logged on or not, Run with highest privileges, Configure for Server 2012, Run on demand enabled.
    Task Action:
    Program: Have tried
    powershell
    powershell.exe
    %windir%\system32\WindowsPowerShell\v1.0\powershell.exe
    %windir%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
    Arguments: Here goes
    (The c:\powershell has been substituted by .\ when "start in" populated also as a test and I have also tried the shorthand version of commands such as -c instead of -command)
    All of the below have been run prefixed with nothing, -file and then -command (not at the same time)
    C:\Powershell\APIMonthlyWSUSCleanup.ps1
    "C:\Powershell\APIMonthlyWSUSCleanup.ps1"
    ("C:\Powershell\APIMonthlyWSUSCleanup.ps1")
    {C:\Powershell\APIMonthlyWSUSCleanup.ps1}
    "{C:\Powershell\APIMonthlyWSUSCleanup.ps1}"
    {"C:\Powershell\APIMonthlyWSUSCleanup.ps1"}
    &{C:\Powershell\APIMonthlyWSUSCleanup.ps1}
    &"C:\Powershell\APIMonthlyWSUSCleanup.ps1"
    &'C:\Powershell\APIMonthlyWSUSCleanup.ps1'
    {&"C:\Powershell\APIMonthlyWSUSCleanup.ps1"}
    &{"C:\Powershell\APIMonthlyWSUSCleanup.ps1"}
    (&"C:\Powershell\APIMonthlyWSUSCleanup.ps1")
    (&{C:\Powershell\APIMonthlyWSUSCleanup.ps1})
    "&{C:\Powershell\APIMonthlyWSUSCleanup.ps1}"
    "& "C:\Powershell\APIMonthlyWSUSCleanup.ps1"
    "& 'C:\Powershell\APIMonthlyWSUSCleanup.ps1'"
    ". 'C:\Powershell\APIMonthlyWSUSCleanup.ps1'"
    Start in: Have tried
    C:\Powershell\
    C:\Powershell
    Last Run Result: 0x0 & 0xFFFD0000
    History - Action Completed with return: 0, 1, 4294770688 & 2147746132
    It would be much appreciated if someone out there can help me to save my sanity.
    If there is one command that you think should work please let me know so I can try it and post back the exact result for that command.
    FYI - I have also tried to run this using CMD and parsing the powershell.exe in the arguments; I'm not keen on doing it that way though due to the string length limitations for future usage.
    Cheers

    There was  two ) ) after param ([String]str$))
    Here is corrected version (Add line to show the date)
    Param ([string]$p) # Parameter for test.ps1
    function LogParameter {
    param ( [string]$str) Add-Content "C:\PowerShell\Test.Txt" (Get-Date)
    Add-Content "C:\Powershell\Test.txt" $str
    LogParameter -Str $P # body of test.ps1
    I tested with a domain\user with domain admins rights. (Selected Run whether user is logged on or not)
    I set the task to run every 5 minutes indefinitely
    At the bottom the page of the Settings tab, I selected "Stop the existing instance" from the list.
    I checked c:\Powershell\test.txt and it shows it is going every 5 minutes.
    In the task manager details page, I can see taskeng.exe running for the doman\user

  • Use a "Write" Event on a Specific Drive or to a Specific Folder to Trigger a Task in Task Scheduler

    I first posted this question on the Microsoft Community forum. It was suggested that I repost it here.
    I have a question!
    (Pleas forgive the long post...)
    What I am trying to do: (This is what I have not yet figured out!)
    I am trying to figure out how to trigger a task, in Windows Task Scheduler (WTS), whenever a "Disk Write" event occurs on a specified drive on the machine. - Or, more specifically, whenever a new file or folder is written or
    saved to a specified Folder, or a specific Disk Partition, or a specific Hard Disk on the machine - whichever is more relevant for the end goal.
    The overall goal:
    When a "disk write" operation occurs and data is written to a specified location on a Hard Drive, start a Program at the beginning of the following hour, that will run a backup of the contents
    of that location, (after - of course - the new data has been written). After the backup is complete, disallow the program from being started again at the beginning of the next hour, unless more data is written to the specified location beforehand.
    Example:
    At 2:27pm, I save a new word document to "D:\My Folder\". When the new Word doc file is saved to "D:\My Folder\", my preferred Backup software application is then scheduled to run a backup at the beginning of
    the following hour - at 3:00pm - which will then create a new backup of "D:\My Folder\".
    The backup software will NOT be scheduled to run again at the next following hour - at 4:00pm - unless another file or additional data is written to "D:\My Folder\" - between 3:00pm and 4:00pm.
    Summary:
    The goal here is to only run a backup at the beginning of the next hour, following a “disk write” event to a specified location on the hard drive.
    Steps that I have, so far, on how to make this happen:
    Whenever data is written to a specified location on a hard drive (i.e. "D:\My Folder\"), "Task A," in Windows Task Scheduler, will be triggered to execute its action.
    The Action in "Task A" will run a script that changes the Status of "Task B" to ENABLED.
    The Action in "Task B" will, on a continuous hourly schedule, start a program that will perform work on the machine. (In this case, it will run a Backup Task in my preferred backup software.)
    Upon completion of work by that program (the Backup software), that program will run another script that will change the Status of "Task B" back to DISABLED; preventing "Task B" from continuing that program every hour
    according to its hourly schedule.
    How do I do this: ... ?
    The thing holding me back on making this work is figuring out how to identify the source that generates the “disk write” event and event ID I need, so I can use it to trigger a task in Windows Task Scheduler - in the way that I need. Furthermore,
    the “disk write” event needs to specific to a disk drive that I specify and if at all possible, specific to a location that I specify, i.e. “D:\My Folder\”.
    Any help on this as well as other suggestions on making this work is greatly appreciated!
    Ryan A Miller

    Hello Ryan A Miller,
    What is your current situation?
    Have you try the script as  Frederik Long mentioned?
    To receive better support, it is recommended to post in the TechNet Script forum.
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
    The professionals there will be glad to help you.
    Best regards,
    Fangzhou CHEN
    Fangzhou CHEN
    TechNet Community Support

  • How to run Powershell script (function) through Windows Task Schduler ??

    Hello All,
    i have Powershell script which is created as a function. I have to give parameters to run the script. And it is working fine. Now i want to run this script through windows task scheduler but it is not working. I dont know how to call powershell function
    through task scheduler.
    From command line i run it like this:
    . c:\script\Get-ServiceStatusReport.ps1
    dir function:get-service*
    Get-ServiceStatusReport -ComputerList C:\script\server.txt -includeService "Exchange","W32Time" -To [email protected] -From [email protected] -SMTPMail mail01.xxx.gov.pk
    In windows Task scheduler I am giving this: it runs but i dont receive any output :
    Program/Script:
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    Parameter:
    -file ". 'Get-ServiceStatusReport.ps1 -ComputerList C:\script\server.txt -includeService  "Exchange","W32Time" -To [email protected] -From [email protected] -SMTPMail  mail01.xxx.gov.pk'"
    Please HELP !!!

    Thanks for the reply:
    The script is already saved as Get-ServiceStatusReport.ps1 .
    On powershell it does not run like .\Get-ServiceStatusReport.ps1 (parameter).
    But i have to call it as function:
    Like this:
    Get-ServiceStatusReport -ComputerList C:\script\server.txt -includeService "Exchange","W32Time" -To [email protected] -From [email protected] -SMTPMail mail01.xxx.gov.pk
    As you said:
    I tried to run it like this:
    Program/Script:
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    Parameter:
    -file "c:\script\Get-ServiceStatusReport.ps1 -ComputerList C:\script\server.txt -includeService  "Exchange","W32Time" -To [email protected] -From [email protected] -SMTPMail  mail01.xxx.gov.pk'"
    But its not working , on scheduler its giving error: (0xFFFD0000)
    Please HELP !!!
    WHOLE SCRIPT:
    function Get-ServiceStatusReport
    param(
    [String]$ComputerList,[String[]]$includeService,[String]$To,[String]$From,[string]$SMTPMail
    $script:list = $ComputerList
    $ServiceFileName= "c:\ServiceFileName.htm"
    New-Item -ItemType file $ServiceFilename -Force
    # Function to write the HTML Header to the file
    Function writeHtmlHeader
    param($fileName)
    $date = ( get-date ).ToString('yyyy/MM/dd')
    Add-Content $fileName "<html>"
    Add-Content $fileName "<head>"
    Add-Content $fileName "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>"
    Add-Content $fileName '<title>Service Status Report </title>'
    add-content $fileName '<STYLE TYPE="text/css">'
    add-content $fileName "<!--"
    add-content $fileName "td {"
    add-content $fileName "font-family: Tahoma;"
    add-content $fileName "font-size: 11px;"
    add-content $fileName "border-top: 1px solid #999999;"
    add-content $fileName "border-right: 1px solid #999999;"
    add-content $fileName "border-bottom: 1px solid #999999;"
    add-content $fileName "border-left: 1px solid #999999;"
    add-content $fileName "padding-top: 0px;"
    add-content $fileName "padding-right: 0px;"
    add-content $fileName "padding-bottom: 0px;"
    add-content $fileName "padding-left: 0px;"
    add-content $fileName "}"
    add-content $fileName "body {"
    add-content $fileName "margin-left: 5px;"
    add-content $fileName "margin-top: 5px;"
    add-content $fileName "margin-right: 0px;"
    add-content $fileName "margin-bottom: 10px;"
    add-content $fileName ""
    add-content $fileName "table {"
    add-content $fileName "border: thin solid #000000;"
    add-content $fileName "}"
    add-content $fileName "-->"
    add-content $fileName "</style>"
    Add-Content $fileName "</head>"
    Add-Content $fileName "<body>"
    add-content $fileName "<table width='100%'>"
    add-content $fileName "<tr bgcolor='#CCCCCC'>"
    add-content $fileName "<td colspan='4' height='25' align='center'>"
    add-content $fileName "<font face='tahoma' color='#003399' size='4'><strong>Service Stauts Report - $date</strong></font>"
    add-content $fileName "</td>"
    add-content $fileName "</tr>"
    add-content $fileName "</table>"
    # Function to write the HTML Header to the file
    Function writeTableHeader
    param($fileName)
    Add-Content $fileName "<tr bgcolor=#CCCCCC>"
    Add-Content $fileName "<td width='10%' align='center'>ServerName</td>"
    Add-Content $fileName "<td width='50%' align='center'>Service Name</td>"
    Add-Content $fileName "<td width='10%' align='center'>status</td>"
    Add-Content $fileName "</tr>"
    Function writeHtmlFooter
    param($fileName)
    Add-Content $fileName "</body>"
    Add-Content $fileName "</html>"
    Function writeDiskInfo
    param($filename,$Servername,$name,$Status)
    if( $status -eq "Stopped")
    Add-Content $fileName "<tr>"
    Add-Content $fileName "<td bgcolor='#FF0000' align=left ><b>$servername</td>"
    Add-Content $fileName "<td bgcolor='#FF0000' align=left ><b>$name</td>"
    Add-Content $fileName "<td bgcolor='#FF0000' align=left ><b>$Status</td>"
    Add-Content $fileName "</tr>"
    else
    Add-Content $fileName "<tr>"
    Add-Content $fileName "<td >$servername</td>"
    Add-Content $fileName "<td >$name</td>"
    Add-Content $fileName "<td >$Status</td>"
    Add-Content $fileName "</tr>"
    writeHtmlHeader $ServiceFileName
    Add-Content $ServiceFileName "<table width='100%'><tbody>"
    Add-Content $ServiceFileName "<tr bgcolor='#CCCCCC'>"
    Add-Content $ServiceFileName "<td width='100%' align='center' colSpan=3><font face='tahoma' color='#003399' size='2'><strong> Service Details</strong></font></td>"
    Add-Content $ServiceFileName "</tr>"
    writeTableHeader $ServiceFileName
    #Change value of the following parameter as needed
    $InlcudeArray=@()
    #List of programs to exclude
    #$InlcudeArray = $inlcudeService
    Foreach($ServerName in (Get-Content $script:list))
    $service = Get-Service -ComputerName $servername
    if ($Service -ne $NULL)
    foreach ($item in $service)
    #$item.DisplayName
    Foreach($include in $includeService)
    write-host $inlcude
    if(($item.serviceName).Contains($include) -eq $TRUE)
    Write-Host $item.MachineName $item.name $item.Status
    writeDiskInfo $ServiceFileName $item.MachineName $item.name $item.Status
    Add-Content $ServiceFileName "</table>"
    writeHtmlFooter $ServiceFileName
    function Validate-IsEmail ([string]$Email)
    return $Email -match "^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$"
    Function sendEmail
    param($from,$to,$subject,$smtphost,$htmlFileName)
    [string]$receipients="$to"
    $body = Get-Content $htmlFileName
    $body = New-Object System.Net.Mail.MailMessage $from, $receipients, $subject, $body
    $body.isBodyhtml = $true
    $smtpServer = $MailServer
    $smtp = new-object Net.Mail.SmtpClient($smtphost)
    $validfrom= Validate-IsEmail $from
    if($validfrom -eq $TRUE)
    $validTo= Validate-IsEmail $to
    if($validTo -eq $TRUE)
    $smtp.UseDefaultCredentials = $true;
    $smtp.Send($body)
    write-output "Email Sent!!"
    else
    write-output "Invalid entries, Try again!!"
    $date = ( get-date ).ToString('yyyy/MM/dd')
    sendEmail -from $From -to $to -subject "Service Status - $Date" -smtphost $SMTPMail -htmlfilename $ServiceFilename

Maybe you are looking for

  • TOP OF PAGE in ALV Grid Display in ECC 6.0

    Hi, I have an issue with top of page in Alv grid display in ECC 6.0. I searched  the forum for this, but couldnt fine any solution. I am using Reuse_alv_commentary_write to display the header. It's working fine in 4.7E but the same code is not workin

  • Patch installation problem...

    Hi, My database is running on Linux.Database version is(9.2.0.4). I have to upgrade database from 9.2.0.4.0 to 9.2.0.6.0. I tried to apply P3948480_9206__Linux.Zip this patch. After unzipping this patch , $./runInstaller Checking Installer Requiremen

  • Calling Batch Input within RFC

    Hello experts. I need to call a Batch Input within a RFC Function. I heard that approach might bring some problems, taking into account that the RFC function must act as a Web Service for a .Net application calling. Has anybody came up with a similar

  • System preferences locks up

    Changing desktop pictures locks system preferences.

  • Is there a way to save potential purchases?

    I surf iTunes quite a bit, but of course I can't always buy everything I want all at once. I usually end up writing down the albums I might want to buy. Is there a way that you can save albums/songs/artists to a "future purchases" folder or something