天蓝色Runbook中的调度

时间:2015-01-21 08:41:08

标签: powershell azure azure-automation

我想安排使用Azure自动化Runbook停止/启动Azure虚拟机。

这是我迄今为止所做的。从Azure管理门户中的库创建新的自动化Runbook。按时间表选择'停止Windows Azure虚拟机'来自' VM生命周期管理' (它的this脚本)。创建Runbook,转到本Runbook的作者页面并按下测试。提供了必要的参数。然后输出中出现了几个错误,从这开始:

1/21/2015 9:15:26 AM, Error: New-ScheduledTaskTrigger : The term 'New-ScheduledTaskTrigger' is not recognized as the name of a cmdlet, function, 
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is 
correct and try again.
At Stop-AzureVMsOnSchedule:41 char:41

为什么无法找到此cmdlet?我尝试从我的机​​器(c:\ Windows \ SysWOW64 \ WindowsPowerShell \ v1.0 \ Modules \ ScheduledTasks)上传资产菜单中的ScheduledTasks模块,但它抱怨格式无效。

您能否给我一个提示,说明为什么这个脚本不起作用,或者您是否知道在自动化Runbook中用于调度任务的替代方法?

2 个答案:

答案 0 :(得分:3)

"按计划停止Windows Azure虚拟机"是一个Azure PowerShell脚本,不适用于Azure自动化中的Runbook。当您尝试从图库中导入它时,您可以看到:

note when you import 'Stop Windows Azure Virtual Machines on a Schedule' script

我建议您导入Runbook以停止由jeffbow创建的VM。通过将此Runbook连接到Azure自动化计划资产,您将能够安排关闭Azure VM:

a good runbook to use for stopping Azure VMs from Azure Automation

答案 1 :(得分:0)

需要编辑此脚本以在Azure自动化中工作。

New-ScheduledTaskTrigger在Azure自动化环境中不起作用。 要安排Automation Runbook,请使用New-AzureAutomationSchedule

https://msdn.microsoft.com/en-us/library/dn690271.aspx

的详细信息
相关问题