简体   繁体   English

在多个Azure VM上以管理员身份运行计划的任务

[英]Run scheduled task as admin on multiple Azure VMs

I am running an Azure Windows VM which runs a batch file when it starts (its started from Task Scheduler). 我正在运行一个Azure Windows VM,该Windows VM在启动时运行一个批处理文件(从Task Scheduler启动)。

The batch file cannot be started as SYSTEM and needs to be run as a user, so I use the VM administrator. 批处理文件不能以SYSTEM身份启动,需要以用户身份运行,因此我使用VM管理员。 In Task Scheduler this user shows as \\. 在任务计划程序中,该用户显示为\\。 This all works fine. 这一切都很好。

My question is though - I want to be able to run many of these VMs by making a VHD of the existing VM then creating more VMs (perhaps in a ScaleSet) from that VHD. 我的问题是-我希望能够通过创建现有VM的VHD,然后从该VHD创建更多VM(也许在ScaleSet中)来运行许多VM。

The script needs to be run when the VM is first started AND if it is ever rebooted. 首次启动VM以及重新引导VM时,都需要运行该脚本。

I assume though that when I do this, my start-up script will break as the MACHINE_NAME will be different for each VM. 我假设尽管这样做,我的启动脚本将中断,因为每个VM的MACHINE_NAME都不同。

What is a good solution for this problem? 对于这个问题有什么好的解决方案?

if it started from task schedular and is a batch job, you can move it to webjobs too and schedule there. 如果它是从任务计划开始的并且是批处理任务,那么您也可以将其移至webjobs并在那里计划。 and then create as many webjobs to want of the same batch file. 然后创建同一个批处理文件所需的多个webjob。 no need to create and maintain VMs 无需创建和维护虚拟机

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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