21 Feb 2012 @ 10:10 AM 

Every once in a while I find myself in an environment where no one has a clue which VM’s are part of a network, let’s say the DMZ.
Since this is mostly identified by IP address/range I create a script to provide me with a list of IP configurations by using the SCVMM cmdlets:

Get-VMMServer localhost | out-null
$VMs = Get-VM
Foreach-object ($VM in $VMs)
{
   if (($VM.ComputerName -ne $NULL) -AND ($VM.ComputerName -ne "*"))
   {   
      $IPS = [System.Net.DNS]::GetHostAddresses($VM.Name)
      trap [System.Exception] {"The following virtual machine is not registered in DNS:"; continue;}
      write-Host ""      
      write-Host "VM:   " $VM.Name
      write-Host "Name: " $VM.ComputerName
      Write-Host "IP:   " $IPS
      Write-Host ""   
   }
}

As you may have noticed, this script uses DNS to resolve the IP address.

Now, with the new PowerShell cmdlets introduced with SCVMM 2012 life suddenly becomes much, much easier… especially for me since I´m a huge fan of one liners Emoticon met brede lach
With SCVMM 2012, use the following to get the same information:

Get-SCVirtualMachine –VMMServer localhost | Format-List -property Name, ComputerName, IPV4Address

Post to Twitter

Posted By: Jeff Wouters
Last Edit: 21 Feb 2012 @ 10:10 AM

EmailPermalinkComments (0)
Tags

 15 Feb 2012 @ 3:36 PM 

Every once in a while I go to a customer that has no clue what operating systems they are running inside their virtual machines. But when this is a datacenter managed with SCVMM, one simple line of PowerShell code is all I need to get the information I desire:

Get-VM –VMMServer SCVMM | Select-Object Name, OperatingSystem | ConvertTo-HTML | Out-File D:\Temp\VMOSList.html

This will provide a nice list with VM names and their operating systems:
image

Note that this command will look at the VM as they are known within SCVMM, not inside the VM!

Post to Twitter

Posted By: Jeff Wouters
Last Edit: 15 Feb 2012 @ 03:36 PM

EmailPermalinkComments (0)
Tags
Categories: Hyper-V, PowerShell, Script, SCVMM





Get Adobe Flash playerPlugin by wpburn.com wordpress themes
 Last 50 Posts
 Back
Change Theme...
  • Users » 1
  • Posts/Pages » 125
  • Comments » 98
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

About



    No Child Pages.

Contact



    No Child Pages.