Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a scheduled task to logon?

Status
Not open for further replies.

crackoo

Programmer
Feb 17, 2011
132
TN
I have been looking for a while on the net "how to create a scheduled task to logon (only after the current user has logged in)" but unfortunately without success
Well I found a lot of scripts that makes repetitive tasks, but in my case I found nothing.
For example here is a script that runs Notepad at 12:30 on Mondays, Wednesdays and Fridays.
Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objNewJob = objWMIService.Get("Win32_ScheduledJob")
errJobCreated = objNewJob.Create _
    ("Notepad.exe", "********123000.000000-420", _
        True , 1 OR 4 OR 16, , , JobID) 
Wscript.Echo errJobCreated
So I'm looking for a way to modify this script or another script to achieve my final goal
Thank you !
 
It's not clear to me what you're trying to achieve.

Are you saying you want something to happen on a PC only after a user has logged on (so the task should NOT happen if nobody is logged on)?

JJ
[small][purple]Variables won't. Constants aren't[/purple]
There is no apostrophe in the plural of PC (or PST, or CPU, or HDD, or FDD, or photo, or breakfast...and so on)[/small]
 
I would like to do like this soft can do a scheduled task after installing it Adwprotector
So you should understand what i mean [thumbsup2]
 
I'm also unclear as to what you are asking. The "theme phrase" is contradictory. I read it as saying "How to create a scheduled task IN ORDER TO login but launch it ONLY AFTER the user has logged in." So, you want to execute event X which is triggered by the future event Y. Impossible! But, I'll stand back from being an ass (too late) and suggest a solution that emulates the impossible (by including a "monitoring" computer) :).

Create a scheduled task on a remote computer that, when executed, sets the autologin registry keys on the operand computer and restarts it (event X). Create a second scheduled task (or AD/GPO Login script) that execute event Y upon logon. When the operand computer is done booting, it will automatically login with the credentials you just entered in the registry and execute Y. This means, however, that the remote computer must be the monitor.

Or are you looking for something more like a login script?

-Geates

"I do not offer answers, only considerations."
- Geates's Disclaimer

 
I'm still not clear. I think he's suggesting a scheduled task to run ADWProtector at some point after a user has logged on...but I'm not sure!

JJ
[small][purple]Variables won't. Constants aren't[/purple]
There is no apostrophe in the plural of PC (or PST, or CPU, or HDD, or FDD, or photo, or breakfast...and so on)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top