Quantcast
Channel: Azure Virtual Machines forum
Viewing all articles
Browse latest Browse all 12545

Script to shutdown/start all VMs in an Azure account

$
0
0

I am trying to write a simple powershell script to shutdown/start all VMs in my Azure account.

The Get-AzureVM cmdlet shows me all the information I want:  cloud service name, VM name and VM status for every VM.

When I use the same cmdlet in the following script ...

$listVM = Get-AzureVM

foreach ($vm in $listVM) write-host $vm }

the output is (once for each VM): Microsoft.WindowsAzure.Commands.SerivceManagement.Model.PersistentVMRoleListContext

How do I iterate a list of VMs (by name ) and start/stop them?

Thanks, Chris


ChrisB



Viewing all articles
Browse latest Browse all 12545

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>