?
Solved

Scheduled Tasks

Posted on 2005-03-30
7
Medium Priority
?
503 Views
Last Modified: 2011-10-03
How can you create scheduled tasks that work without the user having to do something? I previously had a system working from http://www.domaindlx.com/e_morcillo, but with new windows updates they have resricted the use of scheduled tasks. Now i can't even create a task through schtasks.exe without asking the user for their password. I want to be able to set the "Run only when logged on" flag. I did this manually by editing the file after creating the task, but this fails to register at then as a legit task allowed to be run.

I know this is possible cause Norton creates scheduled tasks that run on my computer just fine. All of those have the "Run only when logged on" flag set and do not require a password. Through schtasks i can't even set this flag.
0
Comment
Question by:thaimin
[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
  • 4
7 Comments
 
LVL 8

Expert Comment

by:craigwardman
ID: 13666806
i have previously written an app in VB that may do the job for you..

its not fully tested as i rushed it for a friend, who then discovered windows scheduling and no longer needed it, so i zipped it up and havent touched it since..

if you add it to your windows startup registry key:

HKLM\Software\Microsoft\Windows\CurrentVersion\run

then it will start whenever a user logs in and will proceed to run all tasks in its current list, unless the user chooses cancel within 10secs..

if you press cancel you can add/remove tasks which it should perform on each run..

it doesnt base the schedule on time, simply runs a list of progs each time it itself is run..

if this sounds useful let me know i can send it to you, or make any modifications you may require..
0
 
LVL 29

Expert Comment

by:nffvrxqgrcfqvvc
ID: 13667528
'Using the command line to create,remove,stop,start scheduled tasks is more powerfull.


http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/schtasks.mspx
0
 
LVL 29

Expert Comment

by:nffvrxqgrcfqvvc
ID: 13670454
'You can also use the Microsoft Script Control


Dim strComputer, uintJobID
Dim strAlternateUserID, strAlternatePassword
Dim objWbemLocator, objWMIService, objNewJob
Dim errJobCreated

strComputer = Environ("COMPUTERNAME")

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objNewJob = objWMIService.Get("Win32_ScheduledJob")
errJobCreated = objNewJob.Create("Notepad.exe", "********200000.000000+720", True, 4, , True, uintJobID)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 29

Expert Comment

by:nffvrxqgrcfqvvc
ID: 13670517
0
 
LVL 1

Author Comment

by:thaimin
ID: 13674619
Okay, the schtasks program requires a password, which I really prefer not to ask the user for. And the Miscrosoft Script Control doesn't seem to be able to do on a schedule of "every five minutes" or only at logon/startup and those kinds of schedules.
0
 
LVL 29

Accepted Solution

by:
nffvrxqgrcfqvvc earned 2000 total points
ID: 13674888
You could essentially create your own .exe file to do whatever you want every 5 minutes, which consist of only using a timer control: However I do beliveve you want this to be a scheduled task you can still do it this way as long as you want to execute something every 5 minutes.

Here is a solution:
'Add the below code to the Form_Declerations
'''''

Private Const modMinutes = 5 'wait
Dim currentTick As Integer


'In a timer add the following code below::
'''''''
currentTick = currentTick + 1
    If currentTick >= modMinutes Then
   
    'Your execution code here::::::
   debug.print "5 Minutes"
    DoEvents
   
        currentTick = 0
    End If
''''''''''
'In the Form_Load section add the following code below::::
''''''

currentTick = 0
Timer1.Enabled = True
Timer1.Interval = 60000



'This will use a timer and will execute anything you want to do every 5 minutes..
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

800 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