Solved

task scheduler windows 7

Posted on 2014-01-22
6
453 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The way I use Experts Exchange to assist me in analyzing and diagnosing a problem is I first enter a Verbose Question at Experts Exchange like: Office 2007 will hang when opening and saving files I then launch WordPad (any text editor will do) an…
INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now