Tuesday 15 June 2010

azure - How to schedule a task with user interaction -


I want to schedule a task to stop the exit of the Ezur VM. I have a script that does this, but the problem is that the Stop-AzureVM command in PowerShell prompts the user for the option of 'Y' or 'N' Inside or in the order of the scheduled work) I can send the 'Y' value so that schedule work is not covered over while walking.

  set execution policy Rimotsited $ env: PSModulePath = $ env: PSModulePath + "" + "C: \ Program Files (x86) \ Microsoft SDKs \ Windows Azure \ PowerShellAzure \ PowerShell" Import-module Azure Set-ExecutionPolicy RemoteSigned -Force Set Azure subscriptions "default membership" membership name "foreach ($ in AzureVMObject get-AzureVM) {if ($ AzureVMObject.Name -ne "nAME-VM-DONT-STOP" -and $ AzureVMObject.Status -q "ReadyRole") {Stop- AzureVM- service name $ AzureVMObject.Name- name $ AzureVMObjectName -Force}}    

Why not just -fors flag? If you are trying to de-final VM deployment, it Maybe you need to confirm.

  Stop-AzureVM -ServiceName myservice - name myvmname -Force   

you can also choose to stop the VM, but it can not keep still provision to preserve the IP address:

  stop -AzureVM -ServiceName myser Vice -name myvmname -StayProvisioned   

Note: You will need to get the latest PowerShell cmdlets for Azure to work with -StayProvisioned

No comments:

Post a Comment