Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Windows Task Scheduler

Thread Tools
 
Search this Thread
 
Old 05 April 2008, 01:26 PM
  #1  
druddle
Scooby Regular
Thread Starter
 
druddle's Avatar
 
Join Date: Mar 2001
Location: Berkshire
Posts: 5,528
Likes: 0
Received 0 Likes on 0 Posts
Default Windows Task Scheduler

Hi all

Is there a way of setting a scheduled task in Vista so that it checks to see if iTunes is running, and if so closes it down at a particular time ?

I use Allway Sync to replicate my files to another PC every night but its no point replicating a database file if the database is open. I dont suppose theres a hot backup mode for iTunes....

Dave
Old 06 April 2008, 12:06 AM
  #2  
apalmer
Scooby Regular
iTrader: (8)
 
apalmer's Avatar
 
Join Date: Aug 2007
Posts: 411
Likes: 0
Received 0 Likes on 0 Posts
Default

Not tried on Vista but shouldn't be too hard i would have thought to write a batch file with something like PSKill? Elevation might cause a problem in Vista though
Old 07 April 2008, 04:04 PM
  #3  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Default

save this as a vbs file, change outlook.exe to be whatever the name is and it should kill it for you.

Code:
strApp = "Outlook.exe"
Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2")

wscript.echo "Checking " & strApp
Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process where Name=" & "'" & strApp & "'")

For Each objProcess In colProcessList
	wscript.echo "Killing " & strApp
	objProcess.Terminate()
Next
David
Old 07 April 2008, 10:43 PM
  #4  
druddle
Scooby Regular
Thread Starter
 
druddle's Avatar
 
Join Date: Mar 2001
Location: Berkshire
Posts: 5,528
Likes: 0
Received 0 Likes on 0 Posts
Default

Works a treat, but it comes up with a "checking" prompt and you have to click OK, and then a "killing" one. Can it be modded so that it just checks it and if its alive, it kills it silently, then displays a pop up box saying its either killed or was not present in the first place ?

Sorry, i am not after much am i......

Also, is there a way of doing task dependencies in Task Manager, so that if my iTuneskill.vbs script fails to kill the process, the sync process doesnt run ?

Last edited by druddle; 07 April 2008 at 10:52 PM.
Old 08 April 2008, 12:21 PM
  #5  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Default

pass.. about dependencies..

just delete the lines beginning wscript.echo to stop the prompt, or call it with cscript..

ie "cscript c:\Killprocess.vbs"

David
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
JimBowen
ICE
5
02 July 2023 01:54 PM
KAS35RSTI
Subaru
27
04 November 2021 07:12 PM
hardcoreimpreza
Computer & Technology Related
21
11 October 2015 03:40 PM
FuZzBoM
Wheels, Tyres & Brakes
16
04 October 2015 09:49 PM
Ganz1983
Subaru
5
02 October 2015 09:22 AM



Quick Reply: Windows Task Scheduler



All times are GMT +1. The time now is 06:54 PM.