Scheduler task to save file to KM.

Dear all
I have seen the following blog for scheduler task.
<a href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1515">Link to blog</a>
But my scenario is a little bit different. I want to create a sceduler task which creates and save a file in a particular destination in KM.
Can anybody help me in doing this?
Regards
Aparnna

hi prasad,
I am also tried the same blog  <b>"Did you know you can schedule jobs in portal using KM's Scheduler Task "</b>..
After deploy my Par I am getting my schedular task under Knowledge Management>content Management>Globel Service-->schedular task..... But i didnt get <b>yahoofeed.xml</b> file..
then i have checked..System Configuration >Monitoring>Knowledge Management>Component Monitor>Services-->Schedulers.. my Schedular task status is <b>startup failed</b>...
did u get the result for ur schedular task.. if yes,, plz guide me where I did error..
thanks and regards,
Chinnadurai.R

Similar Messages

  • Schedule task files

    To Create a scheduled task
    The zip file (plugin and jar file) has to be place in
    <middlware>Oracle_IDM1/server/ScheduleTask
    OR?
    <middlware>Oracle_IDM1/server/plugin
    I imported the xml file for the file and it is in MDS /db/scheduledtask.xml
    But I cannot see this job in Scheduled task

    http://docs.oracle.com/cd/E21764_01/doc.1111/e14309/refsched.htm#CIHBFCJG
    http://docs.oracle.com/cd/E21764_01/doc.1111/e14309/refsched.htm#BEIDIFHB
    -Bikash

  • Call Multiple Files From Single ColdFusion Scheduled Task

    Our host only allows us to have 5 scheduled tasks per account but we need to run cfml applications to import data for multiple sites (at least 15 processes).  What I'd like to do is combine all the 'sample requests' for all sites into ONE scheduled task that will run them one after another thus cutting back on the number of scheduled tasks needed.
    We're using ColdFusion to connect to a MySQL DB to gather all sample requests. First the app retrieves all the unflagged records from a remote db then begins looping through all the returned records. On the each loop, the app 'scrubs' the data by properly formatting phone numbers, fixing address abbreviations, etc. Next the app saves the scrubbed data to a local MS SQL table then starts the loop over on the next row. Lastly the app sends out an email saying it has completed successfully.
    What I'm trying to do is Create a New Parent App that will run as a scheduled task to do the following:
    - New Parent App Runs as Scheduled Task and calls/includes first of X sample request app files
    - New Parent App runs first sample request app as described above (which can take up to a minute to process)
    - Parent app waits until after first sample request app completes, then Parent App goes on to second sample request app, etc.
    - After all sample requests are complete New App sends completion email with date and time
    The problem I'm having is getting the scheduled task to wait for apppage1.cfm to finish before loading apppage2.cfm and so on. Can you give me a simple codeset that accomplishes this?
    I've attached a sample of the include page the needs to complete before moving on!

    Our approach is a bit more comprehensive.
    First, we (meaning my co-workers) wrote a custom tag that does something like this:
    <cftry>
    <cfinclude the template>
    <cfcatch>
    log any errors
    Then our actual scheduled job go like this:
    set a really long timeout (and none of the actual jobs can have their own timeout)
    set some variables
    use the custom tag for each job we want to run
    send mail if any errors occurred.

  • Scheduled task won't run .bat file

    Hi. On Windows Server 2008 I have a scheduled task that calls a .bat file. The fist step in the .bat file is write to a log file to the same directory in which the .bat file exists. This allows me to find out if it is ever run. When the .bat file is run from a command prompt it runs as expected writing to the log file and completing its actions. My problem is that when I run the scheduled task manually or allow it to run when scheduled it appears to run but the .bat file is never run. No log file is ever created. The History tab in the properties of the scheduled tasks shows the task being started and running then completing with an operation code of 2. I've disabled the UAC for the user account. I've set the task to run as the Administrator user and verified the permissions for that user. I know the password is correct for the task because I can make changes to the properties and save those changes with the username/password. I'm at a loss for further troubleshooting steps. Can anyone point me in the right direction to figure out why these .bat files are not being run? 

    So I had this problem, I double clicked on the .bat and notepad opened the .bat.  I ran through this whole long and very absorbing thread of this forum.   I wanted to save the entries that were most helpful, so I copied and pasted into
    a notepad document (.txt)  I could not find a way to attach it here, so I copied and pasted that below. I called it a synopsis....  Did I spell that right?
    As you can see, I added my experience at the top (A and B).  The stuff I copied is noted with the original author. This is the first time I posted anything to these here microsoft forums, although I have been telling computers what to do for 40+ years. 
    So hope I did not break any social protocols here.
    ==================================== Begin ====================================
         Running A Dot Bat File in Windows Server 2008 Vista 7 etc and beyond V01
    ============================================================================
    This was created as a synopsis of the entries at the following forum location:
    http://social.technet.microsoft.com/Forums/en/winservermanager/thread/d47d116e-10b9-44f0-9a30-7406c86c2fbe
    A) manually
         This is an opinion added by Thomas Rock
        1) Open a command window (that would be cmd.exe)
        2) In the command window navigate to the directory containing the .bat file and it's dependents
               ex...  C:\Program Files (x86)\Bobs\Your\Uncle
        3) Run the .bat file by typing the name including the .bat extension (in the command window of course)
                 TheBatFile.bat
           Note: Using this method, the .bat file will run in the current command window directory (the directory where the .bat file is located)
                             (this is the key for getting it to run in the task scheduler... Start in folder option)
    B) The double click
                This is an opinion added by Thomas Rock
         1) Using Windows exlporer, find the .bat file
         2) use the mouse or other device to double click on the .bat file
         3) if it does not run (in my case the wordpad application opened the .bat file)
              a) make sure that the .bat file extension is associated with the program c:\windows\system32\cmd.exe
              b) make sure the profile you are using has rights to run the cmd.exe
              c) make sure the profile has the rights to the directories, the .bat and any other objects used or affected by the .bat file processing.
    C) As a task using task scheduler
         Proposed As Answer by Brian Vandemark Wednesday, September 02, 2009 9:36 PM
    1) Make sure that the task is set to "configure for Windows Vista or Windows 2008" on the first page of the task properties (under the "general" tab)
    2) Make sure that the task is set to "start in" the folder that contains the batch file:
          a) open the task properties
          b) click on the "actions" tab
          c) click on the action and then the "edit" button at the bottom. 
          d) In the "Edit Action" Window there is a field for "start in (optional)" that you set to the path to the batch file.
          e) be sure to include an end backslash for the start in path "C:\dir1\dir2\"    (the last backslash is not optional)
    3) Make sure that the task is running as an account that has explicit "Full access" permissions to all these things:
          a) the .bat file itself
          b) the folder containing the .bat file
          c) the target files/folders that are affected by the .bat script. 
               Note:  Inherited permissions did not seem to work.
    4) Make sure that the account running the task is a member of the local "administrators" group for this machine
    5) Make sure that the task is set to "run whether logged on or not"
    6) Tick the box "Run with highest privileges".    
           Note: Point 6 here was from Edson F. Lima Wednesday June 30 2010 1:35 PM
                      The original point 6 was moved to point 7.
    7) The Task should run successfully with expected output when you right-click on the task and select "run" 
            If it does that then it will run successfully when you are logged off.
    D) Still another way as a task using task scheduler
          Proposed As Answer byDarren Wallace Thursday, July 15, 2010 1:41 AM
    This has been bugging me for 6 or 7 months.
    I don't have admin rights to the box and the guy who does is very busy...
    so I've felt the range of emotions mentioned above.
    I tried most everything above as well. But what seemed to get my processes processing, was ...
       • on the General tab, I clicked the Change User or Group button
       • in Select User or Group (first smaller dialog box)  I clicked the Advanced... button
       • in the next Select User or Group (second bigger dialog box) I clicked the Find Now button
       • in the Search results I selected the Administrators (a group) and it returned SERVERname\Administrators into the "Enter the object name to select" entry in the previous dialog box
       • then I clicked OK and returned to the General tab above
       • the options to Run only when user is logged on and Run whether user is logged on or not are no longer available
       • then I made sure that the Run with highest privileges was checked
       • then I clicked OK and during the next scheduled time to run ... it ran
       Note: See note in A) Manually above.
    E) Task scheduler recommendation
         Proposed As Answer byTamusJRoyceThursday, December 01, 2011 3:42 PM
    I have found .bat and .cmd files do not run correctly either.
        My solution:  Don't run the batch file directly. 
           Have TaskScheduler run:  cmd.exe
              with parameter:  /C YourBatchFile.bat
             and start in: C:\SomePath\ (without quotes!) where C:\SomePath\YourBatchFile.bat exists. 
            And then select the radio button for it to run regardless if you are logged in or not.
    Exit errors may not be logged to the Event Log (they weren't when the .bat ran directly from Task Scheduler when I was logged in), so I find it best to manually log your own Event in case a error occurs and you want to send an email.
     REM Logs an event which causes eventlog to send an email when it fails.  Also, "/l application" needs to be lowercase.
    eventcreate /t error /id 203 /l application /d "your logged description."
    And then make a completely separate task with a trigger:  On an event.  Basic Selected.  Log: Application.  Source: EventCreate. Event ID: 203.  And have the action on this task send an email (attaching any generated log files, if needed).
    Hopefully helpful (took me 3 days to figure all this out...gar)
    ===================================== End ===================================
         Running A Dot Bat File in Windows Server 2008 Vista 7 etc and beyond V01
    ============================================================================
     

  • Batch File Won't Run as a Scheduled Task

    I have two batch files that won't run as scheduled tasks but run perfectly fine when I double-click them.
    I've already set them to run with highest privileges, the account running them is an administrator account, that account has full permissions to the folder and file. I've checked every thread I could find but they simply won't run. No error, no log, nothing...
    If I right click the scheduled task and select Run, nothing happens.
    Any ideas?

    Hi,
    As far as I know, you have to enter the script folder in the "Start in" field. Else it just won't work - and won't really give you any meaningful error messages. So, please check your setting.
    Roger Lu
    TechNet Community Support

  • Scheduled task powershell script cant write file

    Hello experts
    I have scheduled task with powershell but cant write CSV file. Below my PS script:
    $ExemptGroup = Get-ADGroup app_users
    Get-ADUser -Filter { -not (memberOf -RecursiveMatch $ExemptGroup.DistinguishedName) } -Properties * |
     Select-Object -Property DisplayName,SamAccountName,WhenCreated,@{Name='Last Logon';Expression={[System.DateTime]::FromFileTime($_.LastLogon).ToString('g')}},LogonCount,@{N='Status';E={
    If ( $_.useraccountControl -match '^(?:514|546|66050|66082)$' ) { 'Disabled' } Else { 'Enabled' } }} |
     Sort-Object -Property DisplayName | Export-Csv C:\Users\22041912\Documents\User_statis_list.csv
    In Powershell my script working normally and writing CSV file but in scheduled task cant write CSV file. Task history told me succesfully finished.
    Anyone suggest? What wrong?

    copy this on a batch file and point the task scheduler to the batch file.
    PowerShell.exe -WindowStyle Hidden  -File
    E:\Shell\OdmaaGet-Aduser.ps1 
    check if it works..
    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

  • Create script\schedules task to clear local app temp files every 1 hour (PS last modified 2 hrs) ? WINDOWS 2008 R2

    create script\schedules task to clear local app temp files every 1 hour (PS last modified > 2 hrs) ? WINDOWS 2008 R2
     can i have the steps to this...how to do?

    This forum is for scripting questions, not script requests.
    You can search the
    Repository for pre-written scripts, and you can also request scripts at the
    script request page.
    -- Bill Stewart [Bill_Stewart]

  • 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

  • Alternatives to PowerShell automation of Excel (Scheduled Task) in a Windows Server 2012 R2 world

    I have a handful of PowerShell scripts that ran as Scheduled Tasks on an old Windows 2008 SP2 server, which output reports as Excel workbooks with multiple worksheets, via a COM object. After migrating these scripts to a new Windows 2012 R2 server,
    these scripts no longer function. The Server 2008 system was running Office 2007, and the new Server 2012 R2 server has Office 2013 installed.
    What is everyone using on their Server 2012 R2 systems to automate generation of multi-sheet reports in Excel via PowerShell and Scheduled Tasks?
    I know that Microsoft has said that automating Office applications server-side in non-interactive mode, but it has worked in the past, until now. (https://support.microsoft.com/kb/257757)
    I've tried the OpenXML PowerTools for PowerShell (https://powertools.codeplex.com/), but Export-OpenXMLSpreadsheet will only export a single worksheet, and they don't support adding worksheets to existing files
    (am I missing something?). I understand the OpenXML PowerTools can be extended in C#, but I don't C#. The PowerShell cmdlets were released in Jan 2012, but don't look to have been updated since then (updates have been the core C# code).
    I've seen recommendations to add C:\Windows\(System32 or SysWOW64)\config\systemprofile\Desktop, but this hasn't worked on Server 2012.
    Has anyone been able to get Excel 2013 to cooperate on Server 2012 R2, or come up with a suitable alternative? I'd rather not start running these scripts from my workstation.
    EDIT:
    I'm not necessarily looking for an Excel answer, since there are OpenXML ways of doing things now without the Excel application.
    Here are some of the errors I'm getting when approaching this from different directions. When I use:
    $excel = New-Object -comobject Excel.Application$workbook = $excel.Workbooks.Add()
    Results in error:
    Exception calling "Add" with "0" argument(s): "Microsoft Excel cannot open or
    save any more documents because there 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."
    At C:\path\to\script.ps1:21 char:2
    + $workbook = $excel.Workbooks.Add()
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ComMethodTargetInvocation
    The server is definitely not lacking for resources.
    I can copy a blank XLSX file and use .Open($xlFile) instead of .Add(), but then when I go to open a CSV file to copy/paste the content to a worksheet, I get this one:
    Exception calling "Open" with "1" argument(s): "The server threw an exception.
    (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))"
    At C:\path\to\script.ps1:65 char:2
    + $tempcsv = $excel.Workbooks.Open($CSVFile)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ComMethodTargetInvocation
    Things that I've tried so far, with no success:
    I created C:\Windows\System32\config\systemprofile\Desktop and C:\Windows\SysWOW64\config\systemprofile\Desktop as suggested here:
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/0751119d-84d5-4a77-8240-1c4802f97375/powershell-scheduled-tasks-wont-start-excel?forum=winserverpowershell
    Add Local Launch and Local Activation permissions to the Microsoft Excel Application DCOM Config, Grant "Read & Execute, List folder contents, Read" permissions on the \config\systemprofile\Desktop folder. Grant "Modify, Read & Execute,
    List Folder Content, Read, Write" permissions for the account on the following folders:
    \config\systemprofile\AppData\Roaming\Microsoft
    \config\systemprofile\AppData\Local\Microsoft
    as suggested here:
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/aede572b-4c1f-4729-bc9d-899fed5fad02/run-powershell-script-as-scheduled-task-that-uses-excel-com-object?forum=winserverpowershell
    @ jrv - I will try posting a similar question in the Excel 2013 forum, but since I'm looking for a scripting solution to produce an OpenXML spreadsheet, and not something that necessarily uses the Excel application (though such a solution would not be turned
    away), I thought this the more appropriate venue.
    (to reiterate from OP) I have seen and acknowledge Microsoft's statements regarding the unsupported nature of automating Office applications in non-interactive environments, but the truth of the matter is, supported or not, it worked in the past (Server
    2008), it's what I inherited from my predecessor, and I know I'm not the only one who has been using Excel in this way. I'm only asking fellow scripters, some of whom must also be using Excel in this "unsupported" fashion, how they are automating
    creation of their spreadsheet reports after moving to Server 2012. A different system modification to make the Excel comObject continue working as before? Direct manipulation of the OpenXML document? Other solutions that may or may not require launching the
    Excel application?

    #1 - Ask in Excel 2013 forum.
    #2 - Microsoft has repeatedlynoted that this is NOT a supported configuration for Office products.
    #3 - What errors are you getting?
    #4 - What have you done to debug this:
    #5 - No one can be of much help unless you post a very simple example of how this fails.
    ¯\_(ツ)_/¯

  • How to find and export all Scheduled Tasks in Domain with multiple servers.

    Hi everyone,
    I have been given a task of finding all of Scheduled Tasks in the Domain on all of the servers. So far I have manage to create a script that will pull out all Scheduled Tasks from one Server, in this case Domain Controller. 
    Butt in my company are more than 150 servers so I am looking for a script that can connect to AD (or LDAP), than to certain OUs, then pull out Server list and than query them for Schedule Task. I have found already some scripts online and tried to adjust
    them butt they simply didnt work.
    I am new in the company and still learning about the system,  this is my first real task so any help will be greatly appreciated.

    Just a tip that I found after running across this myself - if you run a
    Get-AdComputer -filter {operatingsystem -like '*server*'} | ft name | out-file servers.txt
    and then save the output to a text file, it may look good, but there may be white space at the end of the computer names. Make sure that only the computernames are in the file and then the script works great.
    http://absoblogginlutely.net
    This would happen because you are trying to get around the format of the output.  When you want the raw value do it this way;  it is faster and easier:
    Get-AdComputer -filter {operatingsystem -like '*server*'} |
         %{$_.Name } | out-file servers.txt
    Now there can never be any extra spaces and there will be no header to cause problems. 
    This is why it pays to spend time studying the details of how PowerShell works instead of just sticking things together until you get a result.  PowerShell is designed to do all of these things without fudging or guesswork but it requires that you actually
    learn how it works.  I highly recommend stating with a good technical book on PowerShell.
    ¯\_(ツ)_/¯

  • Windows 2008 R2 server Scheduled Task not working

    I have a batch file that writes to a file, when I click it manually it works. However when I have it set in a scheduled task it will create the file but it will not write to the file.
    How can I fix this?

    Hi,
    1.   
    Please try to make sure the
    Task Scheduler: Service is running.
    For details: run 'services.msc', Scroll down to the 'Task Scheduler' service, Check the 'Startup Type' column, The 'Startup Type' should be set to "Automatic",
    Check the 'Status' column.
    If the service is started, it will list 'Started' in the 'Status' column.
    2.   
    Please try to make sure Group Policy preventing the user to run the task.
    3.   
    Please try to make sure UAC has been disabled.
    4.   
    Please try to enabled the
    policy Inclusion list for moderate risk file types, and fill ‘.bat’ in the blank.
    For details:
    User Configuration -> Administrator Templates -> Windows Components -> Attachment Manager
    In addition, please try to refer
    this to troubleshoot.
    If the issue persist, please try to collect more information for further analyze:
    Event log
    ==============
    1. Click "Start", click “Run”, input "eventvwr" and press Enter.
    2. Expand the "Windows Logs" node on the left pane, right-click on "System" and click "Save All Events As"; in the pop-up window, click to choose the Desktop icon
    on the left frame, input "sys" in the "File name" blank, and then click save.
    3. Expand the “Applications and Services Logs”. Click the arrow next to Microsoft, and then Windows, and then TaskScheduler. Click Operational. Click
    "Save All Events As"; in the pop-up window, click to choose the Desktop icon on the left frame, input "policy" in the "File name" blank, and then click save.
    4. Locate the two saved log files on the Desktop and send them to us.
    GPMC.log
    ==================
    a.   
    On domain controller, click Start -> Run, type GPMC.MSC, it will load the GPMC console.
    b.   
    Right click on "Group Policy Result" and choose wizard to generate a report for the problematic computer and user account (please place appropriately). (Choose computer and select the proper user in the wizard)
    c.   
    Right click  the resulting group policy result and click the "Save Report…" => save report to save the report to a HTML file and send it to me.
    please contact me with my account:
    [email protected] to get a workspace to upload the information.
    Hope this helps!

  • Scheduled Tasks CF 8.01

    I have ran into an issue where a scheduled task in CF Admin
    will say the task completed successfully but if I login to that
    specific address it will error out on that same .cfm page. My
    concern is that in the past when my developers have asked me to
    schedule a task my way of making sure it works was to see that
    "Task completed successfully message" Please help!!!

    ClaytonCf8 wrote:
    > I have ran into an issue where a scheduled task in CF
    Admin will say the task
    > completed successfully but if I login to that specific
    address it will error
    > out on that same .cfm page. My concern is that in the
    past when my developers
    > have asked me to schedule a task my way of making sure
    it works was to see that
    > "Task completed successfully message" Please help!!!
    >
    Unfortunately that 'Task completed successfully message' does
    not mean
    much about any actual work. All a scheduled task is after all
    is a
    scheduled HTTP request to some URL. All that successful
    message means
    is that the URL was requested from a web server and
    ColdFusion received
    a response, any response with an HTTP status code of 200,
    from the web
    server.
    A ColdFusion error message is a valid http response with a
    status code
    of 200 as far as a web server is concerned. To know if the
    request
    template actually did what it was supposed to do one needs to
    look out
    the output. That is where the Publish 'Save output to a file'
    and
    'file' controls come in. You can save the output generated by
    the
    request URL to a location for review after the fact to see if
    any error
    message was received. Having the scheduled task generate log
    data
    either on it's own or into one of the ColdFusion logs is
    useful as well.

  • Unable to Configure a PowerShell Script to Run as a Scheduled Task

    Hi ,
    I have a powershell script from Dieters blog http://scug.be/dieter/2011/07/06/scom-2007-how-to-backup-your-unsealed-management-packs/#comment-1058 which backups the unsealed management packs in SCOM. I am able to run the script successfully in the powershell
    prompt but when i schedule it as a task it fails with an error code 1.
    "Task Scheduler successfully completed task "\Backup Unsealed Management Pack" , instance "{xxxxxxxxxxxxxxxxxxxxxxxxxxxx}" , action "Powershell.exe" with return
    code 1."
    I am running the task using the highest privilages and have tried bypassing the script using and have configured the script as per http://www.metalogix.com/help/Content%20Matrix%20Console/SharePoint%20Edition/002_HowTo/004_SharePointActions/012_SchedulingPowerShell.htm
    -ExecutionPolicy Bypass c:\scripts\myscript.ps1
    Still i am unable to run the task without errors. Kindly assist.
    Jesty

    Hi Jesty,
    Please make sure you have followed these steps to schedule a powershell script task:
    1.  Save the powershell script as .ps1 in local computer.
    2.  Right click the .ps1 file and run with powershell and check if the script can run successfully.
    3.  schedule task->action:Start a program->Program/script:powershell.exe->Add argument:-ExecutionPolicy Bypass c:\scripts\myscript.ps1
    Best Regards,
    Anna

  • Need to delete Scheduled Tasks automatically using a script or schtasks.exe, but it is NOT allowing it - PLEASE HELP!

    I have tried and tried to get this to work in a script, but it simply is NOT doing what I need. I am simply trying to run
    schtasks /delete /tn <task name> /f
    but when I do, I receive the following ANNOYING ERROR:
    ERROR: The system cannot find the file specified.
    I am looking right at the task in the Task Scheduler utility, so I know it EXIST!!
    Then, when I run a "schtasks /query" I see that the task I want to delete has the following information:
    INFO: There are no scheduled tasks presently available at your access level.
    I can delete the tasks just fine in the Task Scheduler console, but I NEED this to be automated so these tasks can be deleted on multiple systems. 
    Can someone PLEASE help me out with this. The systems I need this to run on our Windows 7 SP1. 
    Thank you

    Listen up dude, I am not a home user I am a professional and this same issue is spread all over the internet with most professionals scratching their head not understanding why it is not working.
    However, I found the answer here:
    http://www.jonathankeller.com/2012/02/schtasks-query-tn-tasks-over-network.html
    So you see "dude" even your link shows that you were not a professional as any professional would have read the help first.  Your post give no information as to what you are doing and assumes that a system utility is a script which nearly
    all professionals agree that system utilities are not scripts.
    From the question and the very arrogant response it is clear you are a home user with no formal technical training....or are you theoffice manager who was stuck with doing these things for your boss?
    Your "handle" is also very unprofessional and telling about your "I AM Sir Ask A lot".  Try studying the technical information about Windows.  Learn to start with the system help.  It will save you a lot of blood pressure
    excursions.
    Also note that the help is explicit.  Use the folder path syntax returned from /Query and not the one you see in the GUI.  Again - learning to use help first would save a lot of headaches.
    Stick with it kid.  When you get to by half my age you might be able to call yourself a "professional".  Until then - hit the books.
    ¯\_(ツ)_/¯

  • Powershell scheduled task & Excel

    Hey,
    I have created the following script which converts .xls to .csv file which I want to run as scheduled task.(it is a part of a bigger script)
    $Error.Clear()
    $LogFile = $MyInvocation.MyCommand.Definition + ".log"
    $TempFile = 'D:\ConfigMgr_Tools\Maintenance\CreateADStructure.xls'
    Start-Transcript $LogFile
    "Userprofile $env:USERPROFILE"
    #PREVENT ERROR: http://support.microsoft.com/kb/320369/en-us
    $OldCulture = [System.Threading.Thread]::CurrentThread.CurrentCulture
    $OldUICulture = [System.Threading.Thread]::CurrentThread.CurrentUICulture
    "Recieved cultures $OldCulture , $OldUICulture "
    # cultures to en-US
    [System.Threading.Thread]::CurrentThread.CurrentCulture = "en-US"
    [System.Threading.Thread]::CurrentThread.CurrentUICulture = "en-US"
    "Set cultures"
    $objExcel = New-Object -ComObject Excel.Application
    "Created excel object"
    $objworkbook = $objExcel.Workbooks.Open($TempFile)
    "Created workbook object"
    $CSVTempFile = $TempFile -replace ".xl\w*$",".csv"
    if(Test-path $CSVTempFile)
    Remove-Item -Path $CSVTempFile -Force | Out-Null
    Start-Sleep -Seconds 1
    "Removed old csv"
    $objworkbook.SaveAs($CSVTempFile,6) # 6 is the code for .CSV
    $objworkbook.Saved = $true
    "Saved workbook: $CSVTempFile"
    $objworkbook.Close($false)
    $objExcel.Quit()
    #$objExcel.Dispose
    Start-Sleep -Seconds 1
    Stop-Process -Name *EXCEL* -Force
    # reset cultures
    [System.Threading.Thread]::CurrentThread.CurrentCulture = $OldCulture
    [System.Threading.Thread]::CurrentThread.CurrentUICulture = $OldUICulture
    Stop-Transcript
    When I run the script from normal powershell it works without any problem.
    See Transcript output here:
    Windows PowerShell transcript start
    Start time: 20150403135125
    Username: MyDomain\SCCM_CMD
    RunAs User: MyDomain\SCCM_CMD
    Machine: SRV-SCCM02 (Microsoft Windows NT 6.3.9600.0)
    Host Application: powershell.exe -Command & {C:\Users\SCCM_CMD\Desktop\Untitled5.ps1} -executionpolicy Unrestricted
    Process ID: 11300
    Transcript started, output file is C:\Users\SCCM_CMD\Desktop\Untitled5.ps1.log
    Userprofile C:\Users\SCCM_CMD
    Recieved cultures de-DE , en-US
    Set cultures
    Created excel object
    Created workbook object
    Saved workbook: D:\ConfigMgr_Tools\Maintenance\CreateADStructure.csv
    Windows PowerShell transcript end
    End time: 20150403135129
    But when I start the script from scheduled task (using the same powershell.exe parameter) I receive
    following error:
    Exception calling "Open" with "1" argument(s): "Microsoft Excel cannot access
    the file 'D:\ConfigMgr_Tools\Maintenance\CreateADStructure.xls'. 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
    workbook."
    Here the whole transcript output:
    Windows PowerShell transcript start
    Start time: 20150403135143
    Username: MyDomain\SCCM_CMD
    RunAs User: MyDomain\SCCM_CMD
    Machine: SRV-SCCM02 (Microsoft Windows NT 6.3.9600.0)
    Host Application: powershell.exe -Command & {C:\Users\SCCM_CMD\Desktop\Untitled5.ps1} -executionpolicy Unrestricted
    Process ID: 10604
    Transcript started, output file is C:\Users\SCCM_CMD\Desktop\Untitled5.ps1.log
    Userprofile C:\Users\SCCM_CMD
    Recieved cultures de-DE , en-US
    Set cultures
    Created excel object
    Exception calling "Open" with "1" argument(s): "Microsoft Excel cannot access
    the file 'D:\ConfigMgr_Tools\Maintenance\CreateADStructure.xls'. 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
    workbook."
    At C:\Users\SCCM_CMD\Desktop\Untitled5.ps1:21 char:5
    + $objworkbook = $objExcel.Workbooks.Open($TempFile)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ComMethodTargetInvocation
    Created workbook object
    Removed old csv
    You cannot call a method on a null-valued expression.
    At C:\Users\SCCM_CMD\Desktop\Untitled5.ps1:31 char:5
    + $objworkbook.SaveAs($CSVTempFile,6) # 6 is the code for .CSV
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
    The property 'Saved' cannot be found on this object. Verify that the property
    exists and can be set.
    At C:\Users\SCCM_CMD\Desktop\Untitled5.ps1:32 char:5
    + $objworkbook.Saved = $true
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound
    Saved workbook: D:\ConfigMgr_Tools\Maintenance\CreateADStructure.csv
    You cannot call a method on a null-valued expression.
    At C:\Users\SCCM_CMD\Desktop\Untitled5.ps1:35 char:5
    + $objworkbook.Close($false)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
    Windows PowerShell transcript end
    End time: 20150403135147
    Any idea what can cause this?
    I already checked the file exists and there is a folder "desktop" for the user which runs the scheduled task (same user as in normal powershell)

    Just read the first error:
    Exception calling "Open" with "1" argument(s): "Microsoft Excel cannot access
    the file 'D:\ConfigMgr_Tools\Maintenance\CreateADStructure.xls'. 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
    workbook."
    Access is denied except when running elevated.  You need to be sure the account has access.
    Microsoft does not support or recommend using Excel in a non-interactive session.
    ¯\_(ツ)_/¯

Maybe you are looking for