Hypervisor Early Launch

One of the interesting architectural changes in Hyper-V 2012 Server is the boot order. In Windows Server 2008, first booted partition was the OS in parent partition. After booting partition it was launching Hypervisor using hvboot.sys.

hvboot.sys was performing following actions:

  • Detects whether a hypervisor is already loaded or not
  • Determines processor if it is Intel or AMD
  • Loads hypervisor image
  • Invokes hypervisor launch code
  • virtual processor is created

In Windows Server 2012 and Windows 8, now it does early launch of hypervisor before OS and applies microcode updates needed. Therefore OS in the parent partition is booted on a Virtul Processor.

This change also allows you to be able to manage more than 64VPs.

Windows Server 8 – Disk Management with PowerShell 3.0

Before Windows Server 8 and PowerShell 3.0, to manage your local, virtual or remote disks there were no native PowerShell cmdlets. You had only below choices;

– Using Diskpart (Easy for basic tasks but not flexible)

– Using WMI (Flexible but hard to use)

Diskpart has its own arguments and does not permit you to merge with PowerShell commands.

1

And using PowerShell, only chance for disk management is to use WMI library. Here are two examples:

Get-WmiObject -query "Select * from Win32_logicaldisk" |Ft

 

 

$Item = @("DeviceId", "MediaType", "Size", "FreeSpace")      Clear-Host       Get-WmiObject -computer YourMachine -query `       "Select $([string]::Join(‘,’,$Item)) from Win32_logicaldisk `       Where MediaType=12" | sort MediaType, DeviceID `       | Format-Table $item –auto

Not very user friendly right? Smile

From now on, In Windows Server 8 and PowerShell 3.0, you have native disk management cmdlets for local, virtual and remote disks.

In this blog post we’ll cover some of these great commands with examples.

PowerShell 3.0’s new designed ISE has a right pane that shows all available commands in GUI. Here is my previous blog post covers that : http://blogs.technet.com/b/meamcs/archive/2012/03/30/powershell-3-0-shell-from-future.aspx

Using search function within this pane  can sort all required commands.

Typing “disk” brings all available commands related to disk management.

2

Let’s dig in some of these commands in PowerShell 3.0. These are native commands and don’t need importing a module.

First basic command is Get-Disk.

(more…)

Windows Server 8 – Web Based PowerShell !

One another great feature of Windows Server 8 is ability to run your PowerShell commands on your browser from anywhere. This is really amazing feature. While PowerShell is becoming a “must” tool for almost all Microsoft products, using it on your mobile phone or browser will add great value to our day-to-day tasks.

This feature is called as Windows PowerShell Web Access and it resides as a Windows Server 8 feature.

In this blog post we’ll discuss how to install and configure this amazing feature.

PowerShell Web Access is not enabled by default in Windows Server 8. So firstly you have to add this feature using new designed Server Manager.

Open your Server Manager and click  Add Roles and Features

image

Click Next for the Welcome Page.

image

In Features page, Select Windows PowerShell Web Access

(more…)

PowerShell 3.0 – Shell from Future

PowerShell 3.0 is shipped with Windows 8. We are still experiencing some of the great features of Windows Server 8, but PowerShell 3.0 also brings many new features. Thanks to PowerShell Product Team for such a great innovation.

In this blog post, I will discuss about some of simplified syntaxes.

PowerShell Integrated Script Environment has an improved UI design and features.

clip_image002

This is new designed PowerShell ISE console.

Right pane you’ll notice Commands section.

clip_image004

As you know, in PowerShell V2 you have to query available commands or syntax with get-help or Tab button.

In PowerShell 3.0 you can search any kind of command within Commands pane. I searched for commands that includes “printer” and it outputs all available commands.

And also it provides me all required or optional parameters for selected command.

Now i can select Get-Printer cmdlet and fill up mandatory or optional params.

clip_image006

Now just click copy and paste into script pane.

clip_image008

This is a great feature especially for those who don’t like much writing or remembering script syntax.

Another great feature is improved Tab button Smile Now it completes automatically for all kind of parameter, argument etc. within a window.

In below example, I just write Get-Pro and press tab. It brings all available commands that start with Get-Pro

clip_image010

It also brings parameters and arguments.

clip_image012

And finally it gets to you all available processes on your system lively !

clip_image013

Another example of argument auto completion:

clip_image014

Auto completion also works for .Net. If you call [System.Net.DNS] it will bring you all available methods.

clip_image016

Error notification is also available lively.

clip_image017

I think one of the greatest features of PowerShell 3.0 is statement help.

If you press CTRL + J, it will bring you all statements with their usage and examples.

clip_image019

But this is not enough.

Just click one of the statements and then it will paste a template usage example into your Script Pane.

clip_image020

This is a great feature cause I believe many system administrators don’t want to remember usage of each statement. They don’t need any more.

With PowerShell 3.0, you don’t need special $_. Character to filter script outputs.

Below is a simple example in PowerShell 2.0 to get a process that has a name “IDLE”. For complex scripts it is open for mistakes.

clip_image021

In PowerShell 3.0 just put a pipe and write only column name with no special character. It works and looks great.

clip_image022

It’s same for foreach too.

clip_image023

This is a brief post about PowerShell 3.0 features. There are bunch of great features and we will figure out them in our next blogs.

zp8497586rq

Windows Server 8 – Manage Hyper-V 3.0 with PowerShell

One of the major feature of Windows Server 8 is Hyper-V 3.0 This new version of Microsoft virtualization platform brings great improvements and features.

In this blog post we’ll cover a couple of Windows Server 8 Hyper-V PowerShell command lets. Using PowerShell cmdlet will reduce most of day-to-day administrative tasks.

Open Windows PowerShell ISE and begin with first command;

get-vm

Get-VM cmdlet outputs all virtual machines that hosted on local Hyper-V server. As you seen above, it warns us about missing columns. To get more user friendly output, use Format List

get-vm_fl

Get-VM will give you a general idea about virtual machine’s state. That means you can use filters to get specific virtual machine states.

get-vm_2

I used Get-VM cmdlet again but with pipeline and $_. special character. It filters the output to show me only virtual machines that status fields equal “Operating Normally”

Another helpful command is Checkpoint-VM. This cmdlet starts snapshot process for specified virtual machine.

Try get-help to learn which syntax and parameters available for CheckPoint-VM

checkpoint_gethelp

I can use –name parameter to specify virtual machine.

Now firstly I used Get-VM to specify virtual machine and then pipe that information to Checkpoint-VM cmdlet.

checkpoint

As you notice, snapshot process began and finished.

checkpoint_status

Well, what about reverting Virtual Machines to the previous checkpoints? You can check all snapshots for a specific virtual machine with Get-VMSnapshot cmdlet. Required parameter is –VMName.

get-vmsnapshot

Now you have all checkpoint information for a specific VM. That means you can pipe this data to the Restore-VMSnapshot cmdlet.

In below example I used another method to pipe required data. As you see I use Get-VMSnapshot cmdlet’s name property as a Restore-VMSnapshot Name parameter.

But it gives me a confirm popup.

restore-vmsnapshot

If you want to automate administrative tasks through PowerShell, you need to suppress some of confirm dialogs. It is possible with –confirm parameter.

restore-vmsnapshot2

Restoring snapshot..

restore-vmsnapshot3

Let’s look at other cmdlets. Networking is a major component of Hyper-V. Get-VMNetworkAdaptor gives you network interface details of virtual machines.

get-vmnetworkadapter

Also you can use Get-VMSwitch to get Hyper-V network switch details.

get-vmswitch

Let’s try to add another switch to Hyper-V. You need to specify physical network adapter name with –NetAdapterName parameter.

new-vmswitch_hata

As you see above, it couldn’t find any related network adapter on local host. To learn your physical network adapter names just run Get-Netadapter.

get-networkadaptor

get-networkadaptor2

I assigned net adapter name which have a “UP” status value to a variable called $AdapterName.

Now execute New-VmSwitch cmdlet again. But I gives me another error:

new-vmswitch_hata2

It says my physical network adapter is already in use. Let me check.

get-vmswitch2

Yeap. There is already a Hyper-V switch that uses my current physical adaptor and has a “External” switch type. I can convert that Hyper-V switch type from External to Private. That will let free my physical interface.(Wi-Fi)

set-vmswitch

Now creating again.

new-vmswitch_ekledi

You can check from Virtual Switch Manager. As you see a new switch added and bind to physical network card.

hyper-v swicth ekranı

PowerShell can also be used to modify other virtual machine hardware components. Add-VMHardDisk attaches virtual hard disk files (VHD/VHDX) to a VM as additional disks.

add-vmharddisk_hata

But of course firstly you have to create vhdx file separately. Use New-VHD cmdlet.

new-vmdisk

Now you can assign previously created virtual hard disk to a specific VM.

add-vmharddisk_tamam

Here is our newly added disk on Hyper-V manager.

hyper-v disk ekranı

There are bunch of commands that helps you to manage Hyper-V 3.0 on Windows Server 8. In my next blog I’ll cover them.

Thanks.

Windows Server 8–Live Migration Demo

Beta version of Windows 8 went to live on 29th February. Development team announced that it had reached over 1 million downloads within the first 24 hours. Considering this is a pre-release software, 1 million is an incredible start for Microsoft.

I believe lots of you are still experiencing new features.

Windows Server 8 is in front of us as a most current server operating system. Microsoft is positioning Windows Server 8 as the go-to platform for both public and private cloud scenarios. So most major changes for Windows Server 8 can be explored within Hyper-V 3.0.

In this blog post, I’ll cover about truly live storage migration that is one of the key features of Hyper-V 3.0.

Also I will publish a video version of this article in my next blog post.

Storage migration is one of the new features of Hyper-V 3.0. It helps you to transfer virtual machine VHD (VHDX) and configuration items to a new locations. While Hyper-V gets all bits to a new folder, Virtual Machine continues to run with all functionality.

You can accomplish this task using User Interface or PowerShell. Using PowerShell means we can try different various of actions. For example you can query all your virtual machines that meets specific criteria such as name, disk, CPU etc. and run storage migration for queried VMs.

Before dive in step-by-step, let me explain a little bit about Storage Migration background.

Storage migration is supported for both hard disk files, VHD and VHDX. As all you know VHDX is a new virtual hard drive format shipped with Hyper-V 3.0 and brings lots of new functionalities such as;

  • Supports disks much larger than 2TB (Current VHD restriction)
  • It can be mounted and ejected from Windows Explorer.
  • Larger Block sizes
  • Faster speed than VHD disks
  • Can be convertible to VHD and back to VHDX

Storage migration process creates a new virtual hard disk in the destination directory thereupon user initiates Live Storage Migration through UI or PowerShell.

Important part is during source virtual hard disk read and write operations, newly created operations mirrored to the new virtual hard disk. Reads are occurring from the source, writes are happening to both source and destination.

Then Hyper-V initiates copying virtual disks. If your storage array supports Offloaded Data Transfer, storage migration accelerate itself as taking advantage of ODX technology. Let me explain in more detail about ODX;

Offloaded Data Transfer (ODX) introduces a tokenized operation to move data on the storage device. The source file and destination file can be on the same volume, two different volumes hosted by the same machine, a local volume and a remote volume through SMB2, or two volumes on two different machines through SMB2.

ODX in Windows Server 8 allows handing off operations to the storage system that can perform actions with higher performance.

image

Once disk copy process is complete, Hyper-V switch VM to run on destination virtual hard disk. In case of a failure on destination side, there is always fail back option to run back again on source directory. And finally deletes source VHDs.

Now lets take a look how to initiate Live Storage Migration.

First, open your Windows Server 8 Hyper-V Manager and navigate related virtual machine.

image

In my lab environment there is only one single Windows 8 Virtual Machine.

On the right action pane click Move.

image

Move Wizard will ask you to choose Move Type.

image

Choose between “Live Migration” or “Storage Migration”. As you know, Live migration moves virtual machine and its related items to another computer running Hyper-V.

In this case, we just want to simulate storage migration.

image

There are three different choices on Move Options page.

Move all of the virtual machine’s data to a single location: Choose this option to specify one single destination location for all VM items such as disk file, configuration, snapshot, smart paging.

Move the virtual machine’s data to a different locations: This option lets you to specify individual locations for each VM item.

Move only the virtual machine’s virtual hard disk: Moves only virtual hard disk file.

image

That’s a screenshot from “Move the virtual machine’s data to a different locations” option. As you already notice you can move VM items individually.

image

And this is from “Move only the virtual machine’s virtual hard disk:” option. Only choice is virtual machine disk file.

Lets move with option 1.

image

Specify destination location for the VM. Be aware about available disk space on destination folder. For demo purposes, I choose one of my local disks.

image

Preparing to move.

image

To show you that this is a true live storage migration, I started a ping command within Windows 8 Client (VM) that will run through migration process.

image

You can also track migration process within Hyper-V console.

image

If you locate destination folder through windows explorer, you will notice newly created snapshot and configuration files. Also virtual hard disk file bits are growing.

image

It’s almost finished.

image

And Hyper-V deletes source folder items. During migration process, Windows 8 Virtual Machine was fully reachable and live.

image

And that is the new Virtual Hard Disk location.

Thanks.