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
With SCVMM 2012, use the following to get the same information:
Get-SCVirtualMachine –VMMServer localhost | Format-List -property Name, ComputerName, IPV4Address
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:
Note that this command will look at the VM as they are known within SCVMM, not inside the VM!

Categories
Tag Cloud
Blog RSS
Comments RSS
Last 50 Posts
Back
Void « Default
Life
Earth
Wind
Water
Fire
Light 