Archive for the ‘Automation’ Category

How to: Implementing Storage Spaces insides Azure Virtual Machines

Within an Azure Virtual Machine, you should never store your (personal) data on the C: drive or the temporary disk. You can attach new storage disks to the virtual machine, how many disks depends on the VM size you’ve choosen.

View all VM sizes in Microsoft Azure:

In my example I’ve choosen the ‘DS1v2’ VM size, so I can attach two extra (premium storage) disks. Because the maximum size of an disk in Microsoft Azure is 1023 GB, I’ve created multiple disks. Both disks are attached to the virtual machine and we’re going to implement Storage Spaces within the virtual machine. Storage Spaces is software defined storage (SDS) from Windows Server 2012 R2 and above.

Storage Spaces is a built-in Windows Server Role. When combining all the data disks, you can create one, or more, big data volumes in your Windows Virtual Machine. Extremely powerful for example file servers.

1.) First of all I’ve created a new virtual machine using the Azure Portal

2017-02-27_14h41_01    2017-02-27_14h42_11    2017-02-27_14h44_48

2017-02-27_14h45_06    2017-02-27_14h57_06

2.) Next I’ve created two new disks (premium storage – SSD) with tthe size of 1023 GB.

2017-02-27_14h57_22    2017-02-27_14h58_22    2017-02-27_15h00_04

3.) Next I’ve logged in into the new created virtual machine and configured Storage Spaces.

2017-02-27_15h01_25    2017-02-27_15h02_08    2017-02-27_15h04_49

2017-02-27_15h08_16    2017-02-27_15h08_29    2017-02-27_15h09_04

2017-02-27_15h09_17    2017-02-27_15h09_27    2017-02-27_15h09_37


4.) The next step is to create a new virtual disk

2017-02-27_15h10_03    2017-02-27_15h10_26    2017-02-27_15h10_35

2017-02-27_15h11_00    2017-02-27_15h11_08    2017-02-27_15h11_28

2017-02-27_15h11_48    2017-02-27_15h12_01    2017-02-27_15h12_10


5.) The final step is to create the new volume for storing your data on.

2017-02-27_15h12_31    2017-02-27_15h12_43    2017-02-27_15h12_52

2017-02-27_15h13_03    2017-02-27_15h13_24    2017-02-27_15h13_36

2017-02-27_15h14_02    2017-02-27_15h14_14    2017-02-27_15h14_35

As you can see, there’s a new volume of 2 TBwithin the virtual machine. If you’re changing the size of the virtual machine, it is also possible to add some more disks to the virtual machine and extend the Storage Spaces with more terabytes!!



Demo movie: Storage Spaces Direct in Windows Server 2016

The following movie shows the power of Storage Spaces Direct in Windows Server 2016. From the local disks, to storage pools and cluster, all the layers are explained!! Very useful when you want to know exactly how Storage Spaces Direct (S2D) works.

Software Defined will be the feature! So prepare yourself….. 🙂

Free ebook: Microsoft Azure Essentials: Fundamentals of Azure, Second Edition

This book focuses on providing essential information about the key services of Azure for developers and IT professionals who are new to cloud computing. Detailed, step-by-step demonstrations are included to help the reader understand how to get started with each of the key services. This material is useful not only for those who have no prior experience with Azure, but also for those who need a refresher and those who may be familiar with one area but not others. Each chapter is standalone; there is no requirement that you perform the hands-on demonstrations from previous chapters to understand any particular chapter.


Download the free eBook here.

How to: Resize hard disk in Azure Resource Manager (ARM)

Resizing a virtual hard disk in Azure Resource Manager is really easy to do through the Azure Managent Portal. In a few clicks you can extend the virtual hard disk size. Note that the VM should be turned off!! So you need to plan a maintenance window!!
You can also extend the virtual hard disk with PowerShell. In this example I’ve extended the data disk from 25 to 30 GB.

# Specify the VM
$VM = Get-AzureRmVM -ResourceGroupName MSS-DEMO -VMName MSS-DEMO-DC01
# Set the new size of the data disk
Set-AzureRmVMDataDisk -VM $VM -Name MSS-DEMO-DC01-20160801-100246 -DiskSizeInGB 30
# View the new size of the data disk(s)
# Update the configuration in Azure
Update-AzureRmVM -VM $VM -ResourceGroupName MSS-DEMO

2016-08-01_10h31_33    2016-08-01_09h45_27    2016-08-01_10h11_55

2016-08-01_10h12_18    2016-08-01_10h25_33    2016-08-01_10h25_49

2016-08-01_10h31_15     2016-08-01_10h32_11    2016-08-01_10h33_23

1.) Login to the Azure Management Portal
2.) Check the current size of the data disk. In my example 25 GB
3.) Start PowerShell and login to your Azure subscription
4.) Change the data disk to the new value
5.) Update the configuration to Azure
6.) Check the new size of the data disk with PowerShell or within the Azure Management Portal.
In my example the new size is 30 GB.


How to: Create multiple VM’s in Hyper-V within a few seconds

Automation is one of my favorite things. Some actions are just time consuming, so let’s automate these things!! For example, create a demo environment within Hyper-V. This environment needs 8 VM’s. With a few lines of code, this is realy easy to automate, off course with PowerShell.

## Create 8 Gen2 Virtual Machines
## 4 vCPU per VM
## 1 GB per VM
## C: drive 50 GB Dynamic
## D: drive 50 GB Dynamic
## NIC renamed to MGMT
$vSwitchName01 = "NIC - PRI"
$InstallRoot = "E:\DEMO"
$VMName = "HV-0"

## How much VM's 1..8 = 8 VM's
1..4 | % {
New-VHD -Path ($InstallRoot + "\$VMName" + "$_\" + "\$VMName" + "$_" + "_C.vhdx") -SizeBytes 50GB -Dynamic
New-VHD -Path ($InstallRoot + "\$VMName" + "$_\" + "\$VMName" + "$_" + "_D.vhdx") -SizeBytes 50GB -Dynamic
New-VM -VHDPath ($InstallRoot + "\$VMName" + "$_\" + "\$VMName" + "$_" + "_C.vhdx") -Generation 2 -MemoryStartupBytes 1GB -Name ("$VMName" + "$_") -Path $InstallRoot -SwitchName $vSwitchName01

Set-VMProcessor -VMName ("$VMName" + "$_") -Count 4
Set-VM -VMName ("$VMName" + "$_") -AutomaticStopAction ShutDown -AutomaticStartAction StartIfRunning
Enable-VMIntegrationService ("$VMName" + "$_") -Name "Guest Service Interface"

Rename-VMNetworkAdapter -VMName ("$VMName" + "$_") -NewName "MGMT"
Set-VMNetworkAdapter -VMName ("$VMName" + "$_") -Name "MGMT" -DeviceNaming On

Add-VMScsiController -VMName ("$VMName" + "$_")
Add-VMHardDiskDrive -VMName ("$VMName" + "$_") -ControllerType SCSI -ControllerNumber 1 -ControllerLocation 0 -Path ($InstallRoot + "\$VMName" + "$_\" + "\$VMName" + "$_" + "_D.vhdx")

Start-VM -Name ("$VMName" + "$_") | Out-Null

Within a few seconds, I’ve 8 VM’s up and running.

2016-03-23_10h10_00    2016-03-23_10h10_44    2016-03-23_10h11_23

/ Happy Automation!

WEBINAR: Troubleshooting Microsoft Hyper-V


If you’ve been in IT for any length of time, you’ve likely gotten that phone call that you never want to get: Everything is broken! It’s the end of the world! The sky is falling! Your Hyper-V Host or Cluster is broken and you are the person to fix it!

Where do you start?

What are the most common things to look for?

These are exactly some of the questions we’ll be covering in our next webinar, on February 25th, 2016 at 4pm CET / 10am EST!

Microsoft Cloud and Datacenter Management MVPs Didier Van Hoye and Andy Syrewicze will be answering these questions, and will also be sharing some tales from the trenches.

In this webinar you’ll learn Hyper-V troubleshooting basics and solutions to common problems. You’ll also see some Hyper-V oddities that were encountered by Didier and Andy and how these issues were ultimately resolved and with what tools.

It’s one thing to setup and run a virtualization solution. It’s another thing to fix it when it’s broken.

Sign up now to join us on February 25th, 2016 at 4pm CET / 10am EST (30-45mins + live Q&A!) for some tales from the trenches!


How to: Initialize, format and label disks during OSD Task Sequence in SCCM 2012 R2

During a task seuence in Microsoft SCCM 2012 R2, the operating system and applications are installed on the C: drive in most situations. But in some deployments, you definitely want to create more disks. For example, you want to create a D: and E: partition for storing some other data. Maybe for Microsoft SQL or Exchange installation, databases, logfiles or just some other data.

The following script will do all these steps for you during the task sequence. The script initialize, format, partition and label the disks for you….fully automated! 🙂

## Set CD-ROM from E: to X:
Set-WmiInstance -InputObject ( Get-WmiObject -Class Win32_volume -Filter "DriveLetter = 'E:'" ) -Arguments @{DriveLetter='X:'}

$disks = Get-Disk | measure
If($disks.Count -eq 2)
## Initialize all new disks
Initialize-Disk 1
## Format and rename disks
Get-Disk | where {$_.Number -eq "1"} | New-Partition -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel Data -Confirm:$false
## Set drive letters (D: - Data, E: - Backup)
Get-Disk | where {$_.Number -eq "1"} | Get-Partition | where {$_.PartitionNumber -eq 2} | Set-Partition -NewDriveLetter D
elseif($disks.Count -eq 3)
## Initialize all new disks
Initialize-Disk 1
Initialize-Disk 2
## Format and rename disks
Get-Disk | where {$_.Number -eq "1"} | New-Partition -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel Data -Confirm:$false
Get-Disk | where {$_.Number -eq "2"} | New-Partition -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel Backup -Confirm:$false
## Set drive letters (D: - Data, E: - Backup)
Get-Disk | where {$_.Number -eq "1"} | Get-Partition | where {$_.PartitionNumber -eq 2} | Set-Partition -NewDriveLetter D
Get-Disk | where {$_.Number -eq "2"} | Get-Partition | where {$_.PartitionNumber -eq 2} | Set-Partition -NewDriveLetter E

The script first checks how many disks are attached to the server.
If there is only one disk attached, you’ll have only a C: drive available after the deployment.
If there are 2 disks attached, you’ll have a C: and D: drive avalailable after the deployment.
If there are 3 disks attached, you’ll have a C:, D: and E: drive available after the deployment.

The CD-ROM drive will alse changed from E: to X:.

2015-12-18_12h30_44    2015-12-18_12h32_27    2015-12-18_12h32_52

2015-12-18_12h34_31    2015-12-18_12h37_51    2015-12-18_12h41_05


WEBINAR: Scripting & Automation in Hyper-V without SCVMM


Save the date!!

the 10th of december there is a free webinar about automating tasks in your Hyper-V environment without the user of Microsoft System Center Virtual Machine Manager (SCVMM).

This is realy usefull for that customers who don’t have System Center within their environment! Automation and scripting some tasks can save you a lot of time and money!
MVP Thomas Maurer and Technical Evangelist Andrew Syrewicze will present this webinar!