Schedule startup and shutdown of your virtual machines using Azure Automation

Written by ppolyzos

Software engineer based in Athens, Greece

8 Comments

    1. ppolyzos

      You can specify the VMs you want to start or stop using a comma separated string array, like ‘AzureVm1,AzureVM2’ and then perform a loop for each VmName.
      So, you can do something like:

  1. Eli Rios

    How do you properly replace the parameters for the variables?
    Do I have to change [string]$VmName, with the name of my server like this [AzureVM-Srv1]$VmName or without brackets? or AzureVM-Srv1 = $VmName?

    1. ppolyzos

      If I understand correctly your question, if you want to define your server name in VmName, you only to update VmName with AzureVM-Srv1 as shown in Step4.
      What is inside the brackets is to add additional information about the variable, like string or validation like [ValidateSet(“Startup”, “Shutdown”)]. You can have a look also here to learn more about Powershell parameters.

Leave a Comment

Your email address will not be published. Required fields are marked *