Tag Archive
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 set the... »
Setting VM CPU scheduler settings with PowerShell [Hyper-V]
tweetmeme_url = 'http://blogs.msdn.com/b/virtual_pc_guy/archive/2011/10/31/setting-vm-cpu-scheduler-settings-with-powershell-hyper-v.aspx'; 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 Scheduling–Part 4). Today I want... »
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 for... »
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, $successString, $failureString) { #Return success if the return value is... »
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 -eq 0) {write-host $successString} ... »
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" if ($result.ReturnValue -eq 0) {write-host $successString}... »
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 local computer)" # Prompt for the virtual machine to use $VMName =... »
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, $successString, $failureString) { #Return... »
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 ProcessResult($result, $successString, $failureString) { #Return success if the... »
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 the name of the virtual machine that you want... »

![[Google]]( http://www.ccnetworking.com/wordpress/wp-content/plugins/easy-adsenser/google-light.gif)