An easy way to start a set of VM’s in Azure

Here is an easy way to start a set of VM’s in Azure

I put a sleep between them so the DC has time to come online before Exchange.

$ServerArray = "DC-01","Ex-2016"
ForEach ($Server in $ServerArray) {
write-host $server
Start-AzureRMVM –Name $Server -ResourceGroupName dw-ResourceGroup
Start-Sleep -s 120

Advertisements

Getting the Status of all Azure VM’s

I wanted to make sure all my VM’s were shut off in my lab when I’ve completed. Since I’ve converted everything to the resource manager, I couldn’t just use “Get-AzureVM –status” so I came up with this.

 

cls
Get-AzureRmVM -ResourceGroupName dw-ResourceGroup | foreach{
$vm = Get-AzureRmVM -ResourceGroupName dw-ResourceGroup -name $_.name -status
write-host ".."
write-host ".."
write-host "Server  Name – " $_.name
$vm.Statuses.displaystatus[1]}
write-host ".."

 

You want to see “VM deallocated”

 

image