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


script run itself at a specific time using GP

Posted on 2006-05-02
Medium Priority
Last Modified: 2008-01-09

anyone has an idea of a script to run in a specific time "WITHOUT USING SCHEDULED TASKS". for example i want this script to run every day on 400 clients @ 4 pm in an active directory environment (win2k3) and by using GPO

Question by:AZZA-KHAMEES
  • 3
  • 3
  • 3
  • +3
LVL 48

Expert Comment

ID: 16593233

no, you need to use scheduled tasks, GPO does not offer anything to do this

Author Comment

ID: 16593321
hi jay_jay

i know that GPO does not offer this option, that's why im looking for a script that offers this and this script could be run at login

LVL 48

Expert Comment

ID: 16593330
hey mate :)

problem with logon script is that it runs at log on and thats it - it doesnt have a set time fr them to run, if someone has a solution ill be interested though

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.


Author Comment

ID: 16593356

my idea is when a user logs in ,a script will run and will stay inactive untill a specified time that i set

thanks ;)
LVL 48

Expert Comment

ID: 16593364
ah as in a run a script within a script at a certain time, hmm interesting idea

Expert Comment

ID: 16593655
You could create the script that you want to run and make it available on a network share. Then, as part of the logon script for all users you copy this script file to a locally created folder on the users workstation. Then another line in your logon script could be used to schedule the script to run whenever you want, using the AT command. As follows:

The AT command schedules commands and programs to run on a computer at
a specified time and date. The Schedule service must be running to use
the AT command.

AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\\computername] time [/INTERACTIVE]
    [ /EVERY:date[,...] | /NEXT:date[,...]] "command"

\\computername     Specifies a remote computer. Commands are scheduled on the
                   local computer if this parameter is omitted.
id                 Is an identification number assigned to a scheduled command.
/delete            Cancels a scheduled command. If id is omitted, all the scheduled commands on the computer are canceled.
/yes               Used with cancel all jobs command when no further confirmation is desired.
time               Specifies the time when command is to run.
/interactive       Allows the job to interact with the desktop of the user who is logged on at the time the job runs.
/every:date[,...]  Runs the command on each specified day(s) of the week or month. If date is omitted, the current day of the month is assumed.
/next:date[,...]   Runs the specified command on the next occurrence of the day (for example, next Thursday).  If date is omitted, the current day of the month is assumed.
"command"          Is the Windows NT command, or batch program to be run.

See here for more info and examples:


Expert Comment

ID: 16593678

Your Example Script name: defrag.cmd

#Lines to copy this locally using logon script:

md c:\scripts
copy \\servername\sharename\defrag.cmd c:\scripts\defrag.cmd

#Lines used to schedule your script to run using logon script:

at 16:00 /every:M,T,W,Th,F "c:\defrag.cmd"

Expert Comment

ID: 16593686
oops- according to my example that should have read:

at 16:00 /every:M,T,W,Th,F "c:\scripts\defrag.cmd"

(but you have likely got the idea...)

Author Comment

ID: 16593773
dear conradie

thanks for your answer but  the AT command create a job in scheduled tasks which im avoiding to use because imagine this senario:

the AT command creates the job in scheduled tasks and lets say the script runs shutdown.exe, the user shutsdown his PC before the the specified time. the next day the user logs in, another job is been created. so we will have yesterday's job and todays job (AT1 and AT2). in this case the script wont run.

for this reason im looking for a script that wont use scheduled tasks. and the script it self will activate at a specific time.

LVL 15

Accepted Solution

Naser Gabaj earned 1500 total points
ID: 16594560

You request it to be in win2k3 invironment
>>in an active directory environment (win2k3) and by using GPO

I doubt this will work for you as it's applied for win2k not win2k3... am i right?
but it doen't hurt trying, Give it a shut and let me know, Interesting to know.

Also I believe it's better to try this link as well, this example it to run the note pad at specific time, you can use the same thing, and put the script in the startup of the GPO of the said Groups or OU's.



LVL 78

Expert Comment

by:Rob Williams
ID: 16596050
What is it you want the script to do?
Why not try to control it as a scheduled event but run from a server. If you want to shutdown a PC as suggested above, Windows has a built in shutdown command that can be used, but the Sysinternals free one works better:
If you have another purpose in mind, try Sysinternals free PSExec, in combination with a scheduled task on the server, to run an application on a remote system:
LVL 12

Expert Comment

ID: 16598038
first thing that comes to my mind after reading your question is that, the moment one says that on windows machine, he/she wants to run a specific task AT a certain time, you are going to need the task scheduler one way or the other. so i tend to agree with RobWill here.
As for your example of shutting down the PCs at a specific time, Windows 2003 offers a nice little utility called shutdown.exe which can be used to remotely shut down any/ all PCs in the network running windows XP. you can simply run a batch file that says:
           shutdown -s -f -m \\"pc name"
for every PC on your network that you want to shut down.
If required, you can add a switch -t nn (nn is the integer time in seconds), just to make sure that any user that might be working on the pc at that time atleast has some time at hand to save his/her work.
      This batch file in turn can be scheduled on the server using windows scheduler service.

LVL 78

Expert Comment

by:Rob Williams
ID: 16756999
AZZA-KHAMEES, were any of the suggestions such as Sysinternal's PSShutDown satisfactory?

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

Tech spooks aren't just for those who are tech savvy, it also happens to those of us running a business. Check out the top tech spooks for business owners.
How to fix a SonicWall Gateway Anti-Virus firewall blocking automatic updates to apps like Windows, Adobe, Symantec, etc.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

581 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