简体   繁体   中英

How to deploy .exe to scheduler task using Powershell script

I developed a console app and scheduled it to run on Mon-Friday at 9:AM using windows task scheduler, it works fine.

But I was asked to write Powershell scripts or command-line scripts for deployment, like the script should copy the "Release" folder to the server1(deployment env like dev, test or staging or prod) and schedule it in server1's schedule task. Also I have to set "Start in(optional)".

I don't know anything about command-line and PS scripts. All it should do is create the windows schedule task just like the way I did using UI.

If I understand the question correctly you're just trying to create a scheduled task using powershell? If so try starting here: https://blogs.technet.microsoft.com/heyscriptingguy/2015/01/13/use-powershell-to-create-scheduled-tasks/

I had a requirement to schedule an exe, this scheduled task should run every day Mon to Fri at desired time. I never wrote any batch files in last 15 years of my career :), took it up as it came in my way from my manager. Thanks to him or else I would have not known in this new world.

echo off title My 1st batch file for Task scheduler SchTasks /Create /RU "system" /Sc WEEKLY /D MON,TUE,WED,THU,FRI /TN "Leads" /TR "C:/Some.exe" /ST 09:00

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM