Browse by Tags

Tagged Content List
  • Blog Post: Importing a VM with VHDs in Different Paths

    I was recently given an interesting challenge.  I was asked to show how you could use PowerShell to import a virtual machine; where the virtual hard disks were stored in multiple different locations.  Now, if the virtual hard disks were all in a single location, you could just use the “VHDSourcePath...
  • Blog Post: Using Compare-VM on Compare-VM

    I have been spending a lot of time this week looking at all the functionality that is available in the Compare-VM PowerShell cmdlet in Hyper-V.  The core concept of Compare-VM is that it returns a “virtual machine compatibility report” that lets you know about any problems that exist with the virtual...
  • Blog Post: Using PowerShell to Live Migrate to a Computer with a Different Virtual Switch

    So far this week I have shown you how to register and how to import virtual machines with configuration problems using PowerShell.  However, the question I most often hear is this one: how do I use PowerShell to live migrate a virtual machine to another computer – where the virtual switch names...
  • Blog Post: Importing an Incompatible VM with PowerShell

    Yesterday I stepped through the process of registering an incompatible virtual machine with PowerShell .  But what if you want to import the virtual machine instead of registering it?  Well, the process is pretty much identical.  Replace Import-VM with Compare-VM, fix the incompatibilities...
  • Blog Post: Registering an Incompatible VM with PowerShell

    If you have ever tried to register a virtual machine in Hyper-V Manager, and the virtual machine was not compatible with your current computer, you would have seen something like this: This is a GUI experience that allows you to make changes to the incoming virtual machine in order to make it work on...
  • Blog Post: Veeam RDP virtual appliance for remote management of Hyper-V

    Hyper-V has a number of options available for remote management.  System Center Virtual Machine Manager provides a great remote management experience.  The in-box Hyper-V manager works remotely, even in workgroup environments .  And if all else fails – you can always use Remote Desktop...
  • Blog Post: Hyper-V WMI v2 Porting Guide

    I have been getting more and more questions about how to use the Hyper-V v2 WMI namespace recently – so I have just created a TechNet Wiki article that links to a number of samples / documentation pages about how to do this.  You can get all the details here: http://social.technet.microsoft.com...
  • Blog Post: Creating a Virtual Machine with WMI v2

    Most people use the built in Hyper-V PowerShell cmdlets to control Hyper-V these days.  That said, there are people out there who program directly to our WMI APIs.  In Windows Server 2012 we introduced a new WMI namespace – and recently I have been getting a number of questions about how to...
  • Blog Post: Rename the guest OS to match the virtual machine name on Hyper-V

    When you are managing a large number of virtual machines, it can get tricky to keep track of everything. One thing that I see many people doing to help with this is to make sure that the guest operating system has the same network name as the virtual machine name. This makes life a lot easier when moving...
  • Blog Post: Using PowerShell to configure live migration networks in a Hyper-V cluster

    A long time ago, Didier Van Hoye asked me how to configure the networks that should be used for live migration by a Hyper-V cluster using nothing but PowerShell.  Unfortunately, I never got around to getting an answer for him – until today. Didier – this one is for you. Now for a bit of background...
  • Blog Post: PowerShell script to tell you if you need to update your Integration Services

    A while ago I did a blog post that showed you how easy it was to check what version of the Integration Services were installed inside your virtual machines. However, a number of people came back to me and said: “Ben, I do not really care about the version number of the integration services –...
  • Blog Post: PowerShell snippet: “start a virtual machine and wait for a bit”

    Over the last year there are a couple of PowerShell functions that have become a common set of many of my scripts.  One example is this “StartVMAndWait” function: function StartVMAndWait($vmToStart){ start-vm $vmToStart do {Start-Sleep -milliseconds 100} until ((Get-VMIntegrationService...
  • Blog Post: Understanding WMI Job Expiration in Hyper-V

    A long time ago – I blogged about how to handle WMI job objects in Hyper-V. The short story here is that if you script or program against Hyper-V – chances are you will need to look at WMI jobs to find out whether requested operations have completed (operations like starting a virtual machine...
  • Blog Post: PowerShell Script for Exporting a virtual machine

    I need to automate the process of exporting a virtual machine recently – and when I checked around I found that while there are a number of sample scripts out there that show you how to do this (some even on this blog) they are all written in VBScript. As I am now to the stage where PowerShell...
  • Blog Post: Using CPU Reserve to enforce virtual processor ratio

    On Monday I posted a script for configuring virtual machine CPU scheduler settings. This script got me to thinking about another use for the virtual machine CPU reserve. You see, it can also be used to ensure that you do not unintentionally start too many virtual machines at once. If you were to...
  • Blog Post: Setting VM CPU scheduler settings with PowerShell [Hyper-V]

    A while ago I did a number of posts talking about the different controls that are available to you in regards to how Hyper-V schedules virtual machine processor resources ( Hyper-V CPU Scheduling–Part 1 , Hyper-V CPU Scheduling–Part 2 , Hyper-V CPU Scheduling–Part 3 and Hyper-V CPU...
  • Blog Post: How many virtual processors does a virtual machine have?

    A recent forum poster asked: How do I write a script that figures out how many virtual processors a virtual machine has, when it is offline (i.e. not running)? His question showed that he had made a classic mistake when working with the Hyper-V WMI APIs. You see Hyper-V usually has two WMI objects...
  • Blog Post: Deleting a snapshot sub-tree–via PowerShell [Hyper-V]

    Here is a dangerous script! Given a virtual machine name and a snapshot name, it will delete the specified snapshot *and* any snapshots underneath it in the snapshot tree that Hyper-V manager displays: # Function for handling WMI jobs / return values Function ProcessResult($result,...
  • Blog Post: Deleting a snapshot–via PowerShell [Hyper-V]

    Here is a script that will allow you to delete a single snapshot from a Hyper-V virtual machine: # Function for handling WMI jobs / return values Function ProcessResult($result, $successString, $failureString) { #Return success if the return value is "0" if ($result.ReturnValue...
  • Blog Post: Applying a snapshot–via PowerShell [Hyper-V]

    Now that we know how to take a snapshot, and how to list snapshots – let’s start applying snapshots: # Function for handling WMI jobs / return values Function ProcessResult($result, $successString, $failureString) { #Return success if the return value is "0" ...
  • Blog Post: Listing snapshots–via PowerShell [Hyper-V]

    After the relatively trick “taking a snapshot” script – today’s snapshot script is quite easy. Listing the snapshots that a virtual machine has: # Prompt for the Hyper-V Server to use $HyperVServer = Read-Host "Specify the Hyper-V Server to use (enter '.' for the...
  • Blog Post: Taking a snapshot–via PowerShell [Hyper-V]

    This week I am going to be sharing a bunch of scripts that show you how to interact with virtual machine snapshots in Hyper-V. And I am going to start off with the hardest one – taking a snapshot: # Function for handling WMI jobs / return values Function ProcessResult($result...
  • Blog Post: Enabling processor compatibility with a script [Hyper-V]

    When we released Windows Server 2008 R2 we added the ability to make a virtual machines processor more compatible for migration between different hardware platforms (details here ). Here is a PowerShell script to do this for you: # Function for handling WMI jobs / return values Function...
  • Blog Post: Script to attach a USB device to a virtual machine [VPC]

    A couple of people have asked me how to automate attaching a USB device to a Windows Virtual PC virtual machine, so here is a PowerShell script to do just that: # Connect to Virtual PC $vpc = new-object -com VirtualPC.Application # Get VM name $vmName = Read-host "Specify...
  • Blog Post: Change a virtual machines boot order [Hyper-V Script]

    If you need to change the boot order of a virtual machine programmatically (so that it will boot off of the network first – for example) it is relatively straight forward: # Function for handling WMI jobs / return values Function ProcessResult($result, $successString, $failureString) ...
Page 1 of 6 (149 items) 12345»