2015-01-21 50 views
1

我想使用Azure自動化Runbook安排停止/啓動Azure虛擬機。Azure Runbook中的日程安排

這是我迄今爲止所做的。在Azure管理門戶中從圖庫創建新的自動化操作手冊。從「虛擬機生命週期管理」(它是this腳本)中選擇「按計劃停止Windows Azure虛擬機」。創建Runbook,進入本Runbook的Author頁面並按下測試。提供了必要的參數。然後在輸出上出現了幾個錯誤,從此開始:

 
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?我嘗試從我的機​​器上的資產菜單上上傳ScheduledTasks模塊(c:\ Windows \ SysWOW64 \ WindowsPowerShell \ v1.0 \ Modules \ ScheduledTasks),但它抱怨格式無效。

您能否給我一個提示,說明爲什麼這個腳本不工作,或者您是否知道替代自動化操作手冊中的任務計劃?

回答

0

此腳本需要進行編輯才能在Azure自動化中使用。

新的ScheduledTaskTrigger在Azure自動化環境中不起作用。 要調度自動化運行手冊「按計劃停止的Windows Azure虛擬機」是一個Azure的PowerShell腳本沒有被設計成在Azure的自動化運行手冊工作使用新AzureAutomationSchedule

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

2

。你可以看到,當您嘗試從庫導入:

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

我建議,而不是導入停止了jeffbow創建的VM的運行手冊。通過將此Runbook掛接到Azure自動化計劃資產,您將能夠安排關閉Azure虛擬機:

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