Archive for December, 2015

Using Powershell to create Azure VMs in an Availability Set


Azure futures Availability Sets. Workloads placed in an Availability Set are placed in different Fault and Upgrade domains. A Fault domain is a group of Azure resources that are subject to concurrent failure. For example, servers connected to a switch may be in the same Fault domain since switch unplanned failure will disrupt access to that group of servers. An Upgrade domain is a group of Azure resources that are subject to planned down-time as Microsoft performs routine maintenance and upgrades. By placing 2 VMs for example in an Availability Set, Microsoft ensures that they’re placed in different Upgrade and Fault domains. So, in case of unplanned failure or planned upgrade, one of the VMs is always up.

This script is a demo/test of an Availability Set done after the VMs have been provisioned. Adding/removing VM from Availability Set cause the VM to reboot.

The script output may look like:

AvSet05a

At the bottom you can see that the 2 VMs are in different Upgrade and Fault Domains. The Azure Management Interface also reflects the changes performed by the script:

AvSet03a

The Availability Set details can also be seen in the Azure Management Interface under the Cloud Service\Instances page:

AvSet04b

This script is a demo/test of setting up an Availability Set at the time of VM creation. Output may look like:

AvSet04a

 


Using Powershell to generate Word document containing labels from CSV


In some situations you may have a CSV file containing names and addresses and you wish to print labels on standard Avery 5160 paper. You can manually do a mail merge in Word as outlined here or here. However, if you’re trying to automate the process for a recurring scenario, or in an application, or for a large number of CSV files, this script comes in handy.

This script requires MS Word 2003 or above installed on the computer where it is run. csv2Its input is a comma delimited CSV file containing the following headings:

‘First Name’,’Last Name’,’AddressNo’,’Address’,’City’,’State’,’Zip’

Its output is a Word document containing labels ready to print on standard Avery 5160 labels