All posts tagged: Hyper-V VBScript

Hyper-V: VHD Shell Extensions, updated release

I just posted a batch file wrapper around VHD Shell Extensions to find stale VHDs on a Hyper-V Server. However, because of VHDShellExt.vbs design, it will always try to find if the given VHD is associated with a VM on the local Hyper-V machine. One problem with this design is, you need to use the script on all the Hyper-V server machines you have to find any stale VHDs.  I have updated VHDShellExt.vbs to add /Server switch to be able to use it from a non Hyper-V system too. Now, using this new switch you can use the script from even a Windows Server 2003 or Windows XP system.  You can download the new release here http://code.msdn.microsoft.com/VHDShellExt/Release/ProjectReleases.aspx?ReleaseId=3317 Here is the updated documentation for this release http://www.ravichaganti.com/blog/?page_id=612

Hyper-V: finding stale VHDs

I use Hyper-V Server 2008 R2 for running many virtual machines for different purposes. For all of these virtual machines, I either create new VHDs and re-use the existing ones. Here is the problem. I don’t have SCVMM or any similar management software to maintain the VHD library. But I need to keep track of various VHDs because any accidental deletion might lead to unusable virtual machine infrastructure. VHD Shell Extensions script I created a few months back came to my rescue here. If you have not downloaded or started using this script yet, you can do some by visting this page on MSDN Code gallery. So, I just created a batch file wrapper around the VHDShellExt script. Here is what I have @echo off Set SCRIPTPATH=C:\Scripts Set VHDPATH=E:\VHDs :: Find all VHDs from the given VHD Path and use VHDShellExt.vbs for /f %%a IN (‘dir /b /s %VHDPATH%\*.vhd’) do “cscript %SCRIPTPATH% /action:detail /vhd:%%a”  %SCRIPTPATH% is the path to VHDShellExt.vbs and %VHDPATH% is the place where all your VHDs are stored. This script will validate all …

Using GetSummaryInformation() method

GetSummaryInformation() method in the Msvm_VirtualSystemManagementService class gets data like guest OS type, uptime, heartbeat, etc, etc This method is documented here. This one takes SettingData and RequestedInformation as inputs and returns an embedded instance of Msvm_SummaryInformation as the output. I don’t know how to pass the settingdata and RequestedInformation in a proper way. I just used NULL for settingdata and an array of numbers as RequestedInformation. I am not an expert in WMI. So, please excuse my dumb VBScript. It serves the purpose though 🙂 Here is the script for your reference