Solved

task scheduler windows 7

Posted on 2014-01-22
6
480 Views
Last Modified: 2014-01-27
I want to use task scheduler to display a log file once a day.
how do i set task scheduler to display just today's file.

the folder has a new log file with that days date on it
and keeps the old log files in the folder.
0
Comment
Question by:PAP0028
  • 2
  • 2
  • 2
6 Comments
 
LVL 18

Expert Comment

by:Steven Harris
ID: 39801223
We may need some more information for this:

Are you checking by file name only, or just want the latest file in the folder?

How do you want to display it?  Are you using a specific program?
0
 
LVL 6

Accepted Solution

by:
Sasa Kranjac earned 500 total points
ID: 39801373
If the application is creating just one log file per day you can try this PowerShell script:

$DateToCompare = (Get-date).AddDays(-1)

$ItemToRun = Get-Childitem c:\new | where-object {$_.lastwritetime –gt $DateToCompare}

Invoke-Item c:\new\$ItemToRun

Replace c:\new with the path of the log files folder.

This script gets the current date, lists last created file and opens it with an associated program.
0
 

Author Comment

by:PAP0028
ID: 39810501
The program i am using Cobian Backup and its a txt log file.
 Cobian creates a new file once a day. I want the log file to open on the user display.
And yes I want the latest file to show in the folder
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 18

Expert Comment

by:Steven Harris
ID: 39810517
Did you try Sasa Kranjac's suggestion above?

First run the script to verify it works correctly in your scenario, then you can schedule the script to run via task scheduler.

For running PowerShell with Task Scheduler, try checking out the following EE Article.
0
 
LVL 6

Expert Comment

by:Sasa Kranjac
ID: 39811746
The PowerShell script I suggested opens any last created file in the specified folder and opens it with an associated program. In your case these are .TXT files and should be opened (usually) with Notepad, although many applications can read and display textual files.

Test the PowerShell script, modify the code to open the files on target computers and save the script in a file.

Then go to Start, then System and Security, open Administrative Tools. Double-click on Task Scheduler.

On the left pane, click on Task Scheduler Library. In the right pane, in the blank area below scheduled tasks, right-click and choose either Create Basic Task... or Create New Task...
Either way, when prompted for a Program/Script to schedule, point to your PowerShell script and fine-tune the scheduler to your needs.
Don't forget to test the script and the Task.

Check the Task by setting time of execution couple of minutes from the time you are creating the task so you don't have to wait until tomorrow to see if it works.
0
 

Author Closing Comment

by:PAP0028
ID: 39812997
Thanks for the fast answer.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article covers how to install the Microsoft Windows Operating System (OS). What is covered in this article:  > Different Versions and Editions of the Windows OS  > Upgrading versus Fresh Installation of the OS           - Steps to take pr…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question