Powershell & HyperV - The easy way

Managing VMs from PowerShell requires the use of lots of WMI calls but fortunately for us James O'Neill has come to the rescue with a PowerShell script that makes managing HyperV as easy as the rest of PowerShell with straightforward commands like Get-VM. He has produced a PowerShell script much like an include file that you can use to make life easier.

The source is up on codeplex at http://www.codeplex.com/PSHyperv 

And for those who haven't figured out how to do an include in a PowerShell script here you go, you dot source it. Just add the following line to the top of your script.

[code:xml]

. [path to script]\hyperv.ps1

[/code]

Personally I have tinkered and removed the directory listing of all the added functions. Once I got used to the structure of the commands it saved me hundreds of lines of WMI handling and calls. The only task I haven't been able to get it to do is create the VM in a specific directory. I have now manged it with direct WMI calls so I'll go back and try with these extensions either to add to them or use them to manipulate what I need, but that will have to wait for a future post.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Powershell & HyperV - Use elevated permissions

I've been continuing to work on our development environment and staging servers looking at ways to automate things and Powershell seems to be the way to go. I found a great collection of functions ready to use that James O Neill has posted to codeplex, but last week I ran into some problems with them. Using the Get-VM function gave me no output as did a number of other get- functions.

It took a while as i gradually worked through the code trying to see where it was going wrong - debugging a new language is always a liitle bit challenging as you learn what the different syntax and constructions do, but very beneficial in terms of learning how it works. Anyhow eventually i got to the point where i could get the WMI objects to return only the host machine and none of the virtual machines. At this point something clicked, I can't remember what it was now, but I realised that I was running powershell under the administrator account but without elevated privileges. I ran a new instance of powershell "as administrator" and pulled in the hyperV.ps1 file. Typed Get-vm and hey presto the list appeared of all my VMs. 

Whilst I appreciate what Microsoft is trying to do with UAC, I am beginning to wonder how many more times i am going to get caught out by it and whether we will all just end up turning it off!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

WinPE & Hyper-V update

Well, since my last post on WinPE Mike Sterling has blogged how to add the intergration components (the new name for Virtual Machine Additions) to a WinPE image. This means that virtual networking breaks the legacy network adaptor limit of 100MBit and our deployment of images fly through rather than sitting around twiddling their thumbs!

http://blogs.msdn.com/mikester/archive/2008/05/30/using-the-hyper-v-integration-components-in-winpe.aspx 

I only wish i'd thought of it as it's kind of an obvious thing to do to speed things up.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Hyper-V RTM is here!

Always hoping to be the first with news. Microsoft has released Hyper-V in its final form. Only the virtualisation site seems to be updated at the moment but the downloads are available from the following knowledge base article:

   http://support.microsoft.com/kb/950050

For those of you running RC1 you will be very pleased (and in my case releaved) to see that snapshots and saved states created with RC1 are compatible with the final release version, so you don't need to merge all those changes back to a single image and lose your snapshot trees. We're finding them very useful as we're testing sharepoint deployments and feature development.

Of course we're yet to see if it breaks anything!!!

[Update] Taylor Brown has a good list of all the related updates on his blog here.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Sharepoint Context sensitive help in Visual Studio.

Crawling across blogs yesterday I stumbled upon Waldek Mastykarz's blog. His articles on repeatable deplyoments were very interesting, but the post I thought I should pick up on is about extending help in Visual Studio for Sharepoint Development. He's started a codeplex project to build a dynamic help collection so we can gain access to resources without leaving Visual Studio. It's a great idea and he has already contributed some content, inviting the rest of us to fill in the gaps... You can read more here and find the codeplex project here.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Automating the staging server with Hyper-V

We have recently rebuilt our entire development envirnonment and put a lot of shiny new PC's and server. Essentially, we are now working in a complete virtual environment, where our personal development servers, desktops, staging servers etc are all Virtual. Our physical PC's now run Server 2008 and Hyper-V

For those that don't know, Hyper-V is the next generation of Virtual Server and in the development environment give us great control over the server - my favourite being able to take a snapshot of a server at a given point in time, have a tree of these snapshots and being able to merge parts of the tree, or indeed all back into a single virtual disk. These snapshots can be taken at any time - an example being, if I was to install software, snapshot just before the install. If the install fails, revert back to the snapshot.

I'm hoping that Iain will blog about this in more detail very soon (not to Iain - publish these soon! Wink )

As part of our development process, we need to ensure that the staging servers are clean each time we deploy our code and features. To ensure this, we look to get some scripts to automtically turn off the virtual staging servers, scrap the disks and revert to a known good point (those who know the daily build process will be familiar with this). Rather than start from scratch, Taylor from the MS Hyper-V team has some startpoint scripts

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Visio stencil for Sharepoint Site planning

When planning a Sharepoint implementation, I often use Visio to diagram a site hierarchy. In the past, I've used standard shapes, but wante something a bit more representative of the sites / lists / libraries.

Maxime has produced a basic stencil set, but this didnt include everything I wanted (plus I really wanted to use the WSS 3 style icons! Smile ) and TamTam has one for page design

I've attached my stencil for the community. This is the first pass, and is very much work in progress!

The shapes are taken from the Sharepoint icons, as shown below. Each shape has the option of attaching data (URL, Template, Title) and I hope to be able to extend this in future (what about linking to Kivati to graphically build a portal?)

Site Collection 

If there are any comment, please send them in so we can improve

MOSSSiteStructureStencils.zip (193.73 kb)

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Network Cable unplugged in Virtual Server 2005 R2 SP1 running on Windows Server 2008

I was moving our staging servers onto some spare hardware we had recently decomissioned and thought it would be a good chance to play with Server 2008. I first attempted this before the RTM of Server 2008 and ran into networking problems, but at the time I was busy on projects so left it as it was and put it down to being a bug that would probably be fixed in the final release. Well today I tried again to get Virtual Server 2005 R2 SP1 running on a Windows Server 2008 full installation. My VMs transferred across and added fine to the new host. But when i booted them the network connections all said network cable unplugged. D'Oh!. I fiddled a little - change connection to not connected, create new virtual network, etc. all the normal stuf you try before looking for an answer. Whilst I was trying this i then also lost connection to the host - D'Oh!. Fortunately the KVM over IP i fitted a few months back saved a trip to the Server Room.

So here I am again with failing RDP into the server and VMs that won't talk to anything over the network. First thing i found googling was the TCP offload issues. We had encountered these before with our broadcom nics on the Dell servers - causing our Virtual server service to suspend all communication to the service, the VMs talked fine over the network but you couldn't open up the admin web site or the VMRC connections - the only solution was to stop and start the Virtual Server service, not popular during the day when people are using the guests! Sop in this instance Microsoft have given a nice article - http://support.microsoft.com/kb/888750 A small note in the middle reads:

Note If you have any network adapters that Virtual Server 2005 guests use, Microsoft recommends that you disable TCP segmentation offloading.

I used the second method - disable it altogether. Seemed a safer bet to me, especially as there is only one NIC in the server at the moment. Thankfully this allowed me back into the server over RDP, but I was still getting network cable unplugged inside my Virtual Machines.

I figured it was now a virtual server issue as the configuration page for each of the virtual machines showed 0 bytes received and sent even though i kept trying some pings.

A little more googling revealed a hint and then the answer, my VMs had been set to boot up automatically on the previous host as we needed to make sure they didn't go down and not come back up. This meant that the VMs were set to run under a local user account without admin rights. Now it told me when i first added the VMs to this host that the account was not valid - which was fair it was a local user account that didn't exist on this host. Creating the local account and specifying the credentials worked fine. But now the issue transpires to be permissions on the Virtual Network files, or more generally the Virtual Machines and Virtual Network folders. The following article details what's needed :

http://www.microsoft.com/technet/prodtechnol/virtualserver/2005/proddocs/vs_operate_using_secure_vm.mspx?mfr=true

But hang on! This folder is the all users documents folder or as Windows Server 2008 now uses C:\Users\Public\Documents\. Surely everyone has access to that?, or at least the local Users group - but no, Microsoft seem to have locked it down so that by default only administrators gain access! Adding some permissions to the Virtual Networks folder for the local user account the VMs run under and restarting them brought all the virtual NICs to life.

Well I am pleased that it is finally working, but a little frustrated that it was down to some buried permissions that really could have been flagged up in the Virtual Server interface.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

 

Dilbert of the day