Like crontab in linux,is there a solution?
I mean,it's run at a specific time,for instance,12 o'click every day.
So it's not services.msc
You'd want to check the Windows Scheduler, Control Panel -> Scheduled Tasks.
Autoruns is a useful program that shows all sorts of stuff that runs on a windows box.
It's called the Task Scheduler.
The answer involves a few different tools in windows:
To view the current running applications and processes you can use Task Manager or better yet the sysinternals suite of tools - in particular Process Monitor - that can be downloaded from microsoft, which provide even more info of the running processes. To get to task manager you can just do a CTRL+ALT+DELETE or right click on the windows toolbar and select Task Manager.
For something like crontab, there is Task Scheduler that you can use to schedule the running of scripts, applications, etc.
In windows you can also have applications running as services - similar to daemons. Under the administrative Tools in Contorl Panel you will see Services. If you double click it you will get a dialog that shows you all the services currently running. You can also create your own programs that run as services.
its called the task scheduler, also, you can use the at command to set scheduling of task programmatically. See here for syntax
For scheduled execution of applications or jobs, you can use the task scheduler
You can also use windows services in order to schedule long running jobs or see what services are running.
On XP, you can go to start->run and run 'services.msc' to see this list.
Up through 2K: at.exe
On XP and beyond: schtasks.exe
Run Windows Task Manager;
right click the Task Bar
or key Ctrl+Alt+Delete
to launch Task Manager.
You can also run tasklist from
the command line. Type
tasklist /?
for usage.
Related
I have an elevated console running some bat files. Having this console running in elevated mode is mandatory for it to be able to perform some tasks like managing network shares, etc without asking for permissions. But sometimes the scripts also have to launch some applications which are not desired to run elevated. So we want our elevated bats to start come application in non-elevated mode. Is there any built-in way to do this on Windows? Processes were started with DOS command START up to the date.
By the way, the machine is a Windows 7 Ultimate Edition x64.
I know this isue is already discussed programatically in many questions (this collects many of them), but our requirements are bat scripts running on cmd, and any standalone executable that may help in our tasks, like nircmd, 7z, etc.
Clarification: we already have a scheduled task which starts the console elevated, and elevating the console is not the issue os this answer.
The built-in Windows way: START RUNAS ... allows you to run a process as limited user. Here's an example:
runas /trustlevel:0x20000 cmd.exe
Anyway, there are some internal differences between the execution permissions on a process executed that way and another started from the UI with UAC enabled (explorer.exe via normal user interaction, I mean, execution from file browser or from start menu).
On the process started via runas (right) we miss some permissions disabled:
On the process started via runas (right) Administrators have some permisions set over the process:
The Third-Party application way: we can achieve our goal using PSExec, a standalone executable we can find on PSTools from Windows Sysinternals. Here's an example:
psexec -l -d cmd.exe
I've looked very deep into the issue and I've noticed no difference in any of the running permissions or security flags.
From the Microsoft Technet blogs:
PsExec use the CreateRestrictedToken API to create a security context, called a token, that’s a stripped-down version of its own, removing administrative privileges and group membership. After generating a token that looks like one that Windows assigns to standard users Process Explorer calls CreateProcessAsUser to launch the target process with the new token.
These are the best conslussions I've managed to get after many hours of research; anyone who can provide further details will be welcome.
Really not my area of expertise, but would START RUNAS ... or perhaps AT fit the bill?
I need to open one web page periodically, using Task Scheduler.
On Linux I can run crontab job to do that, but this time I have to do on Windows XP.
Can you help me how is it possible to achieve it?
Thank you in advance!
If you want to call a URL using Windows Task Scheduler, you can check this answer. However, there are other options like scheduling tool ATrigger.
Disclaimer: I was among builders of ATrigger. freeware, not commercial.
I have created a BuildProcessTemplate that invokes a custom compiler. This compiler is normally running inside a command shell. It spawns lots of other processes running in a command shell in order to compile the code in parallel.
Now we are migrating to TFS and would like to trigger the build process from TFS. This works fine using the "InvokeProcess" activity. However, when the InvokeProcess activity is started, the command shells are not shown on the agent computer. They are running in the background. We would like them to be displayed.
Is it possible to somehow tell the InvokeProcess that it should interactively start the process?
Thanks for your help,
Christian
I found the solution...
The Build service on the agent machine needs to be run as an interactive process, not as a service. This can be configured from the TFS Administration Console:
Just tick the "Interactive Process" radio button.
(On this Image both TFS application tier and Build service is on the same machine, which should not be done by the way!)
I have cruise control with Nant running on windows 7 machine .Builds work just fine. But I have a task for which i need to start a batch process which opens up an application window (directX based application) and perform some tasks. But this nant task fails all the time , the very first call for device getdevicecaps fails .this thing works on XP. Please help!
And yes if it helps, I am unable to add any publisher tasks to the cruise control server configuration .
This was not the answer you were looking for.
That's because Windows 7, Vista, and the 2008+ flavors basically shut down the ability to open an interactive window from a service completely. Why? Because opening up a UI and presenting it is a huge security risk -- someone with a lower amount of credentials could in many scenarios do tasks they weren't otherwise allowed to do.
AFAIK, the only way you can get around this is to rewrite the task.
This is a Windows 2003 (or later) machine that gets switched on every morning, but no one logs on until some hours later.
I want to use the time in between to run a backup script c:\script\backup.cmd
How can I start this unattended after the machine has come up?
I tried 2 registry keys, but this resulted in the script being run after a user logs on (which is too late):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices
In the end I used Windows TaskScheduler, who has such an option, but I was wondering if there is another possibility?
Short answer: GPEDIT.MSC (Start, Run, GPEdit.msc)
Windows 2000 and above [1] offer a computer Startup Scripts collection in the policy editor:
Computer Settings -> Windows Settings -> Scripts (Startup/Shutdown)
There's an equivalent logon script area (i.e. after computer startup, when a user logs on) in the User configuration bit.
Longer:
GPEDIT.MSC is the Group Policy editing console, and runs against the local computer's Local Group Policy store when it's used directly, so it's useful for setting local-only parameters. When using Active Directory, a similar interface is used to edit AD Forest-hosted group policy objects (GPOs), so the same settings are available across a bunch of machines.
The computer startup scripts run in the computer context, i.e. as LocalSystem, as you noted, so they often can't access network drives which require a certain user or group membership to work. When domain-member computers access network resources, they generally (with exceptions) authenticate using their MACHINENAME$ account - which lets you set Share/NTFS permissions to allow a computer to access those resources.
A startup script is a quick and easy way of getting a process running when the machine boots.
The computer startup process will be affected by the time it takes to run the program, though, so you might want to ensure you call it with the START command from a batch file, or specifying not to wait for the executable to complete in whatever script language you use. (the key point there is: run the script asynchronously unless it's critical, or doesn't need to be run asynchronously cos it will always take no time at all. Long boots = unhappy users).
Using a Win32 Service is an alternative option - you can use the SRVANY utility from the Resource Kit to "service-ify" pretty much any executable. VS.Net 2002 and later also let you build a managed service directly.
And Task Scheduler gets much more capable as of Vista/2008, able to run scripts at startup, on idle, and/or when Event Logs are generated or certain other conditions are met: it's pretty cool! Scheduled Tasks has the possible advantage of being able to specify the user account under which the task runs, if that's important to you.
Caveat Scriptor:
http://support.microsoft.com/kb/256320
Run Startup Scripts Asynchronously:
http://msdn.microsoft.com/en-us/library/ms811602.aspx
Vista Task Scheduler (what's new):
http://technet.microsoft.com/en-us/appcompat/aa906020.aspx
[1] Windows XP, 2003, Vista/2008, Windows 7/2008R2, Windows 8/2012, Windows 8.1/2012R2, Windows 10/Windows Server 2016. Everything. But NT4 didn't!
You have already outlined a good solution:
Setup a scheduled task to run at Start Up and allow the job to run when the user isn't logged on.
You can run a script at system startup using group policy gpedit.msc
The way you aleady do this seems fine to me; however if you want an alternative approach then services get started when the machine boots so you could write a service that detects if it's a new day (to allow for reboots) and if it is then run your backup.
If I was doing this as a service I'd use TCL because I know it and like it and it has an extension twapi that allows you to run a script as a service. Other scripting languages may well have similar facilities.
There is, if you're using Active Directory. If you can isolate the computer to its own OU or use WMI filtering, you could assign a GPO which has a startup script for the computer. This would ensure that even if someone went in via safe mode and disabled the Task Scheduler, upon startup and connection to the domain, the script would run.