Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Scheduled Tasks

Posted on 2005-03-30
7
Medium Priority
?
508 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
  • 4
6 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
Independent Software Vendors: 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

571 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