TONYSO

Tonyso Credo: "Look for a pattern, and solve it for everything"

August, 2009

  • Hyper-V How To: Detect if you are inside a VM

    Sometimes, when troubleshooting or for forensic reasons, you may have to determine if an application is running inside a virtual machine. John Kelbley, co-author of Windows Server 2008 Hyper-V : Insiders Guide to Microsoft's Hypervisor , shares how. ...
  • Hyper-V R2 How To: Move a VM + storage + snapshots

    Want to move a VM from server A to server B along with its associated storage and snapshots in R2? Snapshots are associated with the VMs and not the VHD files. You should explore import/export. Soumya’s written a series of blogposts to get you started...
  • Hyper-V How To: Modify VM VLAN IDs for Server Core using Script

    Need to remotely set the VLAN IDs on your server core installation? Some friends on the Hyper-V team put together a powershell 2.0 script for setting vlan id which you could run on the server core directly (rename the extension of the script to .ps1)...
  • Hyper-V How To: Modify VLAN Settings using Script

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for modifying hte VLAN settings on your VMs: # Modify VLAN setting for VM param( $vmName = $(throw "Must supply a virtual machine name"), $vlanId = $(throw "Must supply vlan...
  • Hyper-V How To: Find the right Hyper-V Cmdlet

    Jamesone’s excellent PowerShell Management Library for Hyper-V includes a Hyper-V cmdlet documentation PDF file that helps you chunk all the things you can do with Hyper-V using PS, for example, the following list of cmdlets parsed by function: Admin...
  • Hyper-V How To: Shut Down VMs using Script

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for shutting down your VMs: # Shutdown a Virtual Machine (requires Integration Components) param( [string]$vmName = $(throw "Must specify virtual machine name") ) # Get the...
  • Hyper-V How To: Delete a VM using Script

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for deleting a VM: # Delete a VM param( [string]$VMName = $(throw "Must specify name of virtual machine to delete") ) #Obtain the VM object that we are going to destroy $query...
  • Hyper-V How To: Build a Virtualized Test Infrastructure

    I recently had the opportunity to chat with Rodney Fournier, Senior PFE at Microsoft, about building and running a testing infrastructure with our virtualization and management products, including Hyper-V R2, SCVMM, Operations Manager, Configurations...
  • Hyper-V How To: Change VM State using Script

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for changing the VM state: # Change state of VM param( [string]$vmName = $(throw "Must supply a virtual machine name") [int]$newState = $(throw "Must specify a state to change...
  • Hyper-V How To: Add a Virtual NIC to a VM using Script

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for adding a virtual NIC to a VM: # Add a NIC (synthetic ethernet port) to a virtual machine param( [string]$vmName = $(throw "Must specify virtual machine name"), [string]...
  • Hyper-V How To: Expand a VHD

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for expanding VHD: # Expand a VHD param( [string]$vhdPath = $(throw "Must specify full path for VHD"), [string]$vhdSize = $(throw "Must specify expansion to add to VHD (in MB...
  • Hyper-V TV: How to Fix BIOS error “Hypervisor is not running…”

    In this 5 minute video Windows Server Technical Writer Felipe Ayora demonstrates how to change the BIOS settings on your computer to make the hypervisor run. NOTE: remember to completely power off your computer after making the changes to the BIOS. Some...
  • Hyper-V How To: Add a PT Disk to A VM with a Script

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for adding a pass-through disk to a VM: # Add a pass-through disk to a VM param( [string]$vmName = $(throw "Must specify virtual machine name"), [int]$ideNum = $(throw "Must...
  • Hyper-V How To: Reset VM MAC address range using a script

    A friend has shared a script for resetting MAC address ranges on the NIC in your VMs if you are getting conflicts: Option Explicit Dim strComputer, objWMIService, IPConfig, IPConfigSet, i, currentIP, arrayIP, lastOcet, lastOcetHex Dim colItems...
  • Hyper-V How To: Delete Snapshot using Script

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for deleting a VM snapshot: However BEFORE you go deleting snapshots , please read the Hyper-V Snapshot FAQ , and have a look at the Ben Armstrong Snapshot FAQ Video . # Delete...
  • Hyper-V How To: Copy-VM

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for copying a VM: ################################################################################ # # Copyright ©2008 Microsoft Corporation. All rights reserved. # # File: Copy...
  • Hyper-V How To: List Snapshots using Script

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for getting a list of snapshots: # List Virtual System Snapshots #Obtain the VM name $VM_Name= Read-Host("Please specify the name of the VM ") $HostName = "." #obtain the...
  • Hyper-V How To: Check Hypervisor Heartbeat using Script

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for checking in the hypervisor is running on a Hyper-V server (host/parent partition): # Check if Hypervisor is running $hypervisor = gwmi –ErrorAction SilentlyContinue Win32_PerfRawData_HvStats_HyperVHypervisor...
  • Hyper-V How To: Create a VM using Script

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for creating a VM: # Create a VM param( [string]$vmName = $(throw "Must supply a virtual machine name") ) # Get a new instance of Msvm_VirtualSystemGlobalSettingData $vsgsdClass...
  • Hyper-V How To: Change ISO in VM Virtual DVD Drive using Script

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for changing the ISO in a VM DVD drive: # Change ISO in virtual DVD drive param( [string]$vmName = $(throw "Must specify virtual machine name"), [int]$ideNum = $(throw "Must...
  • Hyper-V How To: Map your Virtual Network Settings using Script

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for getting a mapping your virtual network settings: # Navigate Network Topology to determine Virtual Switch type # ie: Internal, External, External-Shared, or Private # Prompt...
  • Hyper-V How To: Merge VHDs using Script

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for merging VHDs: # Merge VHDs param( [string]$mergePath = $(throw "Must specify full path for merging VHD"), [string]$parentPath = $(throw "Must specify full path of parent...
  • Hyper-V How To: Apply VM Snapshot with Script

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for applying a virtual machine snapshot to a VM: # Apply Virtual System Snapshot param( [string]$vmName = $(throw "Must specify virtual machine name"), [string]$vmSnapName ...
  • Hyper-V How To: Convert a VHD using Script

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for converting your VHDs: # Convert a VHD param( [string]$vhdPath = $(throw "Must specify full VHD path, including extension"), [string]$destPath = $(throw "Must specify full...
  • Hyper-V How To: Connect a Virtual Switch to a VM using Script

    Some friends here on the Hyper-V team shared a PowerShell 2.0 script for connecting a virtual switch to a VM: # Connect Virtual Switch to VM param( [string]$vsName = $(throw "Must specify virtual switch name"), [string]$vmName = $(throw "Must...