<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Richard Siddaway's Blog : Hyper-V, Virtualisation</title><link>http://msmvps.com/blogs/richardsiddaway/archive/tags/Hyper-V/Virtualisation/default.aspx</link><description>Tags: Hyper-V, Virtualisation</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>Creating Virtual machines #1: Creating the VM</title><link>http://msmvps.com/blogs/richardsiddaway/archive/2012/12/12/creating-virtual-machines-1-creating-the-vm.aspx</link><pubDate>Wed, 12 Dec 2012 20:20:09 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1820803</guid><dc:creator>RichardSiddaway</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/richardsiddaway/rsscomments.aspx?PostID=1820803</wfw:commentRss><comments>http://msmvps.com/blogs/richardsiddaway/archive/2012/12/12/creating-virtual-machines-1-creating-the-vm.aspx#comments</comments><description>&lt;p&gt;I’ve had two projects in mind for a while.&amp;#160; First I need to build a new WSUS server in my virtual environment &amp;amp; secondly I want to automate as much of the VM creation and configuration as possible. Oh – and I’m not using SC Virtual Machine Manager.&amp;#160; &lt;/p&gt;  &lt;p&gt;I’ll be using the Hyper-V cmdlets that come with Windows 2012.&lt;/p&gt;  &lt;p&gt;I covered some of this in &lt;a href="http://www.manning.com/siddaway2/" target="_blank"&gt;PowerShell and WMI&lt;/a&gt; but that was for Windows 2008 R2 and I was using James O’Neills hyper-v functions.&amp;#160; &lt;/p&gt;  &lt;p&gt;Does it get any easier with the cmdlets&lt;/p&gt;  &lt;p&gt;This is what I came up with&lt;/p&gt;  &lt;pre class="PowerShellColorizedScript"&gt;&lt;span style="color:#00008b;"&gt;function&lt;/span&gt; &lt;span style="color:#8a2be2;"&gt;new-virtualmachine&lt;/span&gt; &lt;span style="color:#000000;"&gt;{&lt;/span&gt;            
&lt;span style="color:#a9a9a9;"&gt;[&lt;/span&gt;&lt;span style="color:#00bfff;"&gt;CmdletBinding&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;]&lt;/span&gt;            
&lt;span style="color:#00008b;"&gt;param&lt;/span&gt; &lt;span style="color:#000000;"&gt;(&lt;/span&gt;            
 &lt;span style="color:#a9a9a9;"&gt;[&lt;/span&gt;&lt;span style="color:#00bfff;"&gt;parameter&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#000000;"&gt;Mandatory&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;=&lt;/span&gt;&lt;span style="color:#ff4500;"&gt;$true&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;]&lt;/span&gt;            
 &lt;span style="color:#008080;"&gt;[string]&lt;/span&gt;&lt;span style="color:#ff4500;"&gt;$name&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;,&lt;/span&gt;            
             
 &lt;span style="color:#a9a9a9;"&gt;[&lt;/span&gt;&lt;span style="color:#00bfff;"&gt;parameter&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#000000;"&gt;Mandatory&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;=&lt;/span&gt;&lt;span style="color:#ff4500;"&gt;$true&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;]&lt;/span&gt;            
 &lt;span style="color:#008080;"&gt;[string]&lt;/span&gt;&lt;span style="color:#ff4500;"&gt;$path&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;,&lt;/span&gt;            
 &lt;span style="color:#008080;"&gt;[Int64]&lt;/span&gt;&lt;span style="color:#ff4500;"&gt;$mem&lt;/span&gt; &lt;span style="color:#a9a9a9;"&gt;=&lt;/span&gt; &lt;span style="color:#800080;"&gt;4GB&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;,&lt;/span&gt;            
 &lt;span style="color:#008080;"&gt;[string]&lt;/span&gt;&lt;span style="color:#ff4500;"&gt;$vswitch&lt;/span&gt; &lt;span style="color:#a9a9a9;"&gt;=&lt;/span&gt; &lt;span style="color:#8b0000;"&gt;&amp;quot;Local Area Connection - Virtual Network&amp;quot;&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;,&lt;/span&gt;            
            
 &lt;span style="color:#a9a9a9;"&gt;[&lt;/span&gt;&lt;span style="color:#00bfff;"&gt;ValidateSet&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#8b0000;"&gt;&amp;quot;Windows2012&amp;quot;&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;,&lt;/span&gt; &lt;span style="color:#8b0000;"&gt;&amp;quot;Windows2008R2&amp;quot;&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;,&lt;/span&gt; &lt;span style="color:#8b0000;"&gt;&amp;quot;Windows7&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;]&lt;/span&gt;            
 &lt;span style="color:#008080;"&gt;[string]&lt;/span&gt;&lt;span style="color:#ff4500;"&gt;$iso&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;,&lt;/span&gt;            
            
 &lt;span style="color:#008080;"&gt;[switch]&lt;/span&gt;&lt;span style="color:#ff4500;"&gt;$startvm&lt;/span&gt;            
&lt;span style="color:#000000;"&gt;)&lt;/span&gt;            
            
&lt;span style="color:#0000ff;"&gt;Write-Verbose&lt;/span&gt; &lt;span style="color:#000080;"&gt;-Message&lt;/span&gt; &lt;span style="color:#8b0000;"&gt;&amp;quot;Testing VM Path&amp;quot;&lt;/span&gt;            
&lt;span style="color:#ff4500;"&gt;$vpath&lt;/span&gt; &lt;span style="color:#a9a9a9;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;Join-Path&lt;/span&gt; &lt;span style="color:#000080;"&gt;-Path&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$path&lt;/span&gt; &lt;span style="color:#000080;"&gt;-ChildPath&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$name&lt;/span&gt;            
&lt;span style="color:#00008b;"&gt;if&lt;/span&gt; &lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;-not&lt;/span&gt; &lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;Test-Path&lt;/span&gt; &lt;span style="color:#000080;"&gt;-Path&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$vpath&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;/span&gt;&lt;span style="color:#000000;"&gt;{&lt;/span&gt;            
 &lt;span style="color:#0000ff;"&gt;New-Item&lt;/span&gt; &lt;span style="color:#000080;"&gt;-Path&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$path&lt;/span&gt; &lt;span style="color:#000080;"&gt;-Name&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$name&lt;/span&gt; &lt;span style="color:#000080;"&gt;-ItemType&lt;/span&gt; &lt;span style="color:#8a2be2;"&gt;Directory&lt;/span&gt;            
&lt;span style="color:#000000;"&gt;}&lt;/span&gt;            
            
&lt;span style="color:#00008b;"&gt;switch&lt;/span&gt; &lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#ff4500;"&gt;$iso&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;/span&gt;&lt;span style="color:#000000;"&gt;{&lt;/span&gt;            
 &lt;span style="color:#8b0000;"&gt;&amp;quot;Windows2012&amp;quot;&lt;/span&gt; &lt;span style="color:#000000;"&gt;{&lt;/span&gt;&lt;span style="color:#ff4500;"&gt;$isopath&lt;/span&gt; &lt;span style="color:#a9a9a9;"&gt;=&lt;/span&gt; &lt;span style="color:#8b0000;"&gt;&amp;quot;C:\Source\Windows 2012 RTM\en_windows_server_2012_x64_dvd_915478.iso&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;}&lt;/span&gt;            
 &lt;span style="color:#8b0000;"&gt;&amp;quot;Windows2008R2&amp;quot;&lt;/span&gt; &lt;span style="color:#000000;"&gt;{&lt;/span&gt;&lt;span style="color:#ff4500;"&gt;$isopath&lt;/span&gt; &lt;span style="color:#a9a9a9;"&gt;=&lt;/span&gt; &lt;span style="color:#8b0000;"&gt;&amp;quot;C:\Source\Window 2008R2\en_windows_server_2008_r2_standard_enterprise_datacenter_and_web_with_sp1_x64_dvd_617601.iso&amp;quot;&lt;/span&gt; &lt;span style="color:#000000;"&gt;}&lt;/span&gt;            
 &lt;span style="color:#8b0000;"&gt;&amp;quot;Windows7&amp;quot;&lt;/span&gt; &lt;span style="color:#000000;"&gt;{&lt;/span&gt;&lt;span style="color:#ff4500;"&gt;$isopath&lt;/span&gt; &lt;span style="color:#a9a9a9;"&gt;=&lt;/span&gt; &lt;span style="color:#8b0000;"&gt;&amp;quot;C:\Source\Windows7 RTM\en_windows_7_ultimate_x86_dvd_x15-65921.iso&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;}&lt;/span&gt;            
&lt;span style="color:#000000;"&gt;}&lt;/span&gt;            
            
&lt;span style="color:#0000ff;"&gt;New-VM&lt;/span&gt; &lt;span style="color:#000080;"&gt;-Name&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$name&lt;/span&gt; &lt;span style="color:#000080;"&gt;-MemoryStartupBytes&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$mem&lt;/span&gt; &lt;span style="color:#000080;"&gt;-Path&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$vpath&lt;/span&gt; &lt;span style="color:#000080;"&gt;-BootDevice&lt;/span&gt; &lt;span style="color:#8a2be2;"&gt;CD&lt;/span&gt; &lt;span style="color:#000080;"&gt;-NewVHDPath&lt;/span&gt; &lt;span style="color:#8b0000;"&gt;&amp;quot;$vpath\$name.vhdx&amp;quot;&lt;/span&gt; &lt;span style="color:#000080;"&gt;-NewVHDSizeBytes&lt;/span&gt; &lt;span style="color:#800080;"&gt;120GB&lt;/span&gt; &lt;span style="color:#000080;"&gt;-SwitchName&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$vswitch&lt;/span&gt;            
&lt;span style="color:#0000ff;"&gt;Add-VMDvdDrive&lt;/span&gt; &lt;span style="color:#000080;"&gt;-VMName&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$name&lt;/span&gt; &lt;span style="color:#000080;"&gt;-Path&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$isopath&lt;/span&gt;            
            
&lt;span style="color:#00008b;"&gt;if&lt;/span&gt; &lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#ff4500;"&gt;$startvm&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;/span&gt;&lt;span style="color:#000000;"&gt;{&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;Start-VM&lt;/span&gt; &lt;span style="color:#000080;"&gt;-Name&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$name&lt;/span&gt;&lt;span style="color:#000000;"&gt;}&lt;/span&gt;            
&lt;span style="color:#000000;"&gt;}&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;The new VM name and path are mandatory, I’ve set a default memory size of 4GB&amp;#160; and added a default Virtual switch. I’m adding the iso file containing the OS I want to install – that’s constrained by the set validation and I have a final parameter that allows me to start the VM.&lt;/p&gt;

&lt;p&gt;if the path in which I want to create the VM doesn’t exist I create it.&lt;/p&gt;

&lt;p&gt;A switch statement is used to set the full path to the iso file.&lt;/p&gt;

&lt;p&gt;The New-VM cmdlet is used to create the VM based on the information provided.&amp;#160; I do hard code the fact that I’m setting the VM to boot from the CD and that the virtual disk will be 120GB&lt;/p&gt;

&lt;p&gt;Add-VMDvdDrive is used to add the DVD drive to the VM (the controller location is automatically worked out) and the iso file mounted.&lt;/p&gt;

&lt;p&gt;If the startvm switch is used then the VM starts and OS install commences. I’m deliberately NOT automating the OS setup at this time – that may be another project.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1820803" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/richardsiddaway/archive/tags/Hyper-V/default.aspx">Hyper-V</category><category domain="http://msmvps.com/blogs/richardsiddaway/archive/tags/Virtualisation/default.aspx">Virtualisation</category><category domain="http://msmvps.com/blogs/richardsiddaway/archive/tags/PowerShell+V3/default.aspx">PowerShell V3</category><category domain="http://msmvps.com/blogs/richardsiddaway/archive/tags/Windows+Server+2012/default.aspx">Windows Server 2012</category></item><item><title>Networking pains</title><link>http://msmvps.com/blogs/richardsiddaway/archive/2011/06/26/networking-pains.aspx</link><pubDate>Sun, 26 Jun 2011 19:57:27 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1795241</guid><dc:creator>RichardSiddaway</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/richardsiddaway/rsscomments.aspx?PostID=1795241</wfw:commentRss><comments>http://msmvps.com/blogs/richardsiddaway/archive/2011/06/26/networking-pains.aspx#comments</comments><description>&lt;p&gt;Last week my wireless router decided that it had enough and wasn’t going to work any more. This was annoying because I was due to give a user group presentation that night.&lt;/p&gt;  &lt;p&gt;I got a new router up and working but today discovered that connectivity from my Hyper-V environment wasn’t working. With the previous router I’d configured bridging between a Hyper-V virtual network and the wireless adapter in my host. That had to be recreated at which point I discovered that the new router didn’t want to support bridging.&lt;/p&gt;  &lt;p&gt;I ended up using RRAS and NAT to get the connectivity. The instructions I found here&lt;/p&gt;  &lt;p&gt;&lt;a title="http://sqlblog.com/blogs/john_paul_cook/archive/2008/03/23/using-wireless-with-hyper-v.aspx" href="http://sqlblog.com/blogs/john_paul_cook/archive/2008/03/23/using-wireless-with-hyper-v.aspx"&gt;http://sqlblog.com/blogs/john_paul_cook/archive/2008/03/23/using-wireless-with-hyper-v.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;provide most of what you need.&lt;/p&gt;  &lt;p&gt;Remember to set the default gateways and DNS servers properly for it all to work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1795241" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/richardsiddaway/archive/tags/Windows+Server+2008+R2/default.aspx">Windows Server 2008 R2</category><category domain="http://msmvps.com/blogs/richardsiddaway/archive/tags/Hyper-V/default.aspx">Hyper-V</category><category domain="http://msmvps.com/blogs/richardsiddaway/archive/tags/Virtualisation/default.aspx">Virtualisation</category></item><item><title>Lenovo W510, Hyper-V and BSOD</title><link>http://msmvps.com/blogs/richardsiddaway/archive/2010/08/06/lenovo-w510-hyper-v-and-bsod.aspx</link><pubDate>Fri, 06 Aug 2010 18:12:34 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1775493</guid><dc:creator>RichardSiddaway</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/richardsiddaway/rsscomments.aspx?PostID=1775493</wfw:commentRss><comments>http://msmvps.com/blogs/richardsiddaway/archive/2010/08/06/lenovo-w510-hyper-v-and-bsod.aspx#comments</comments><description>&lt;p&gt;Beginning of the week I took delivery of a Lenovo W510 – i7 quad core with Hyper-Threading (Windows sees 8 cores) and 16GB of RAM.&amp;#160; From reviews I’d seen it seemed to run Hyper-V OK so it fitted the bill for a mobile lab.&lt;/p&gt;  &lt;p&gt;Partitioned the disk OK and got Windows 2008 R2 installed.&amp;#160; Had to download a few drivers from the Lenovo (IBM) site but everything I needed was there or on the box already.&amp;#160; I’d ordered it with Windows 7 64bit so most of the drivers were available.&lt;/p&gt;  &lt;p&gt;Installed Hyper-V and joined it to the domain.&lt;/p&gt;  &lt;p&gt;Started moving Virtual Machines on to it and it started crash with a Blue Screen of Death.&amp;#160; Not good &amp;amp; I’m not amused at this point. Eventually got to the point where it wouldn’t start – continual BSOD.&amp;#160; Very not good – my new toy is going back if this continues!&lt;/p&gt;  &lt;p&gt;Did some research and it seems there can be a conflict between core parking and Hyper-V.&amp;#160; Core parking is a power saving technology that puts cores to sleep if they are not being used. Hyper-V expects them to be there = BANG.&lt;/p&gt;  &lt;p&gt;I booted into the BIOS screen and disabled the power management features on the CPU (and PCI bus for good measure) that enable core parking.&amp;#160; Restarted and everything now seems OK.&lt;/p&gt;  &lt;p&gt;I can comfortably run a bunch of VMs and have a reasonable performance.&amp;#160; &lt;/p&gt;  &lt;p&gt;Then I discovered that I had to reactivate Windows on all the VMs.&amp;#160; They’d been originally been running on a machine with AMD processor. New processor is Intel.&amp;#160; Its enough of a change to trigger reactivation.&lt;/p&gt;  &lt;p&gt;All done and everything seems to work fine.&lt;/p&gt;  &lt;p&gt;Time to get Virtual Machine Manager installed and see what that actually does.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1775493" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/richardsiddaway/archive/tags/Technology/default.aspx">Technology</category><category domain="http://msmvps.com/blogs/richardsiddaway/archive/tags/Windows+Server+2008+R2/default.aspx">Windows Server 2008 R2</category><category domain="http://msmvps.com/blogs/richardsiddaway/archive/tags/Hyper-V/default.aspx">Hyper-V</category><category domain="http://msmvps.com/blogs/richardsiddaway/archive/tags/Virtualisation/default.aspx">Virtualisation</category></item></channel></rss>