Windows Task Scheduler Installer

后端 未结 2 862
没有蜡笔的小新
没有蜡笔的小新 2021-01-12 20:01

I have a little .exe written in c# .net that I want to run on the server every 24 hours. So naturally I would just use the Windows Task Schedular rather then doing the math

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-12 20:24

    I know this is an old question, but I figure this may help someone else:

    You can use the following to run in cmd.exe

    FOR /F %1 IN ("path to text file containing list of servers") do psexec.exe \\%1 -u 
    "username to execute schtasks under" -p "password" schtasks /Create /S %1 
    /RU "username that will run the task" /RP "password" /XML "xml file of 
    the task to install" /TN "name of the task"
    

    This will loop through the list of servers in a text file (1 server per line) and use psexec to call schtasks on each server and install your task.

提交回复
热议问题