Hi Guys,
I had been looking for a script for a while that would interrogate my VMWare ESX clusters and report back with a list of virtual machines running with dynamic disk.
BTW , I am speaking for Windows Guest VMs. not VMWare level.
I am trying to use invoke-vmscript to get the dynamics disk informations of multiple VM's. But no luck.
Here is my code so far:
$outputFile = "C:\Temp\FetchVmInfo\Vminfo.csv"
$VCenterlist = Get-Content C:\Temp\FetchVmInfo\VCenterlist.txt
"Connecting vCenter servers ..."
Connect-VIServer $VCenterlist
"Getting VM(s). Be patient, this can take some time ..."
$VMsWithPower = Get-VM | ? {($_.GuestId -match "Windows") -and ($_.powerstate -eq "PoweredOn")}
foreach ($vm in $VMsWithPower) {
if ( $null -eq ( Get-WmiObject Win32_DiskPartition -filter "Type='Logical Disk Manager'" -ComputerName $vm) ) {
Write-host "Dynamic disk not found (What's OK!)"
} else {
Write-host "Oh no! Dynamic disk FOUND"
Add-Content -Path $outputFile -Value "Hostname: $($CurrentServer)"
}
}
thanks,