Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

task scheduler windows 7

Posted on 2014-01-22
6
Medium Priority
?
502 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:
Sasha Kranjac earned 2000 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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:Sasha 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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…
The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
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…

688 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